I want to convert a bunch of jpeg files to one pdf file. The files are in a numbered format:
gls -v 2014-2015-2016_R_TR-4_all_170213*.jpeg
gives:
'2014-2015-2016_R_TR-4_all_170213 1.jpeg'
'2014-2015-2016_R_TR-4_all_170213 2.jpeg'
'2014-2015-2016_R_TR-4_all_170213 3.jpeg'
'2014-2015-2016_R_TR-4_all_170213 4.jpeg'
'2014-2015-2016_R_TR-4_all_170213 5.jpeg'
'2014-2015-2016_R_TR-4_all_170213 6.jpeg'
'2014-2015-2016_R_TR-4_all_170213 7.jpeg'
'2014-2015-2016_R_TR-4_all_170213 8.jpeg'
'2014-2015-2016_R_TR-4_all_170213 9.jpeg'
'2014-2015-2016_R_TR-4_all_170213 10.jpeg'
This is the order the jpegs should be shown in the pdf.
ls -l
gives
-rw-r--r-- 1 rziege staff 662186 13 Feb 16:06 2014-2015-2016_R_TR-4_all_170213 1.jpeg
-rw-r--r-- 1 rziege staff 867422 13 Feb 16:06 2014-2015-2016_R_TR-4_all_170213 10.jpeg
-rw-r--r-- 1 rziege staff 642198 13 Feb 16:06 2014-2015-2016_R_TR-4_all_170213 2.jpeg
-rw-r--r-- 1 rziege staff 1110602 13 Feb 16:06 2014-2015-2016_R_TR-4_all_170213 3.jpeg
-rw-r--r-- 1 rziege staff 1068419 13 Feb 16:06 2014-2015-2016_R_TR-4_all_170213 4.jpeg
-rw-r--r-- 1 rziege staff 1326947 13 Feb 16:06 2014-2015-2016_R_TR-4_all_170213 5.jpeg
-rw-r--r-- 1 rziege staff 1248453 13 Feb 16:06 2014-2015-2016_R_TR-4_all_170213 6.jpeg
-rw-r--r-- 1 rziege staff 1106629 13 Feb 16:06 2014-2015-2016_R_TR-4_all_170213 7.jpeg
-rw-r--r-- 1 rziege staff 1152435 13 Feb 16:06 2014-2015-2016_R_TR-4_all_170213 8.jpeg
-rw-r--r-- 1 rziege staff 1300553 13 Feb 16:06 2014-2015-2016_R_TR-4_all_170213 9.jpeg
-rw-r--r-- 1 rziege staff 867422 13 Feb 16:06 2014-2015-2016_R_TR-4_dir_170213 10.jpeg
-rw-r--r-- 1 rziege staff 642718 13 Feb 16:06 2014-2015-2016_R_TR-4_dir_170213 2.jpeg
-rw-r--r-- 1 rziege staff 1118243 13 Feb 16:06 2014-2015-2016_R_TR-4_dir_170213 3.jpeg
-rw-r--r-- 1 rziege staff 1074675 13 Feb 16:06 2014-2015-2016_R_TR-4_dir_170213 4.jpeg
...
I tried this by
convert "$file"*.jpeg "$file".pdf
with
$file=2014-2015-2016_R_TR-4_all_170213
which produces the pdf file in the the wrong order (1, 10, 2, 3, ...).
My alternative approaches
gls -v "$file"*.jpeg | convert "$file".pdf
and
convert $(gls -v "$file"*.jpeg) "$file".pdf
do not work either. Does anybody have a clue how I get this to work?