I have this list of pdf files in a directory:c0.pdf   c12.pdf  c15.pdf  c18.pdf  c20.pdf  c4.pdf  c7.pdfc10.pdf  c13.pdf  c16.pdf  c19.pdf  c2.pdf   c5.pdf  c8.pdfc11.pdf  c14.pdf  c17.pdf  c1.pdf   c3.pdf   c6.pdf  c9.pdfI want to concatenate these using ghostscript in numerical order (similar to this):gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf *.pdfBut the shell expansion order does not reproduce the natural order of the numbers but the alphabetical order:$ for f in *.pdf; do echo $f; donec0.pdfc10.pdfc11.pdfc12.pdfc13.pdfc14.pdfc15.pdfc16.pdfc17.pdfc18.pdfc19.pdfc1.pdfc20.pdfc2.pdfc3.pdfc4.pdfc5.pdfc6.pdfc7.pdfc8.pdfc9.pdfHow can I achieve the desired order in the expansion (if possible without manually adding 0-padding to the numbers in the file names)?I've found suggestions to use ls | sort -V, but I couldn't get it to work for my specific use case.
Glob with Numerical Order
bash;filenames;wildcards
Depending on your environment you can use ls -v with GNU coreutils, e.g.:gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \   -sOutputFile=out.pdf $(ls -v)Or if you are on recent versions of FreeBSD or OpenBSD:gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \   -sOutputFile=out.pdf $(ls | sort -V)