Philipp Klaus Krause
2019-01-26 20:36:28 UTC
I rarely write bash scripts, so I am not surprised I ran into trouble
with spaces in filenames in one:
#!/bin/bash
for i in `seq $2 $3`; do
base=$1-$i
image=${base}.jpeg
pdflist="${pdflist} \"$base.pdf\""
tesseract "$image" "$base" -l deu pdf;
done
pdfjoin $pdflist && rm $pdflist
mv "$1"-"$3"-joined.pdf "$1".pdf
I wrote and use this script to convert JPEG images (names e.g.
test-1.jpeg, test-2-jpeg, etc) to searchable pdf (names test.pdf).
However, the
pdfjoin $pdflist
isn't working when $1 contains spaces. Apparently the quotes are
disappearing somewhere along the way.
Philipp
with spaces in filenames in one:
#!/bin/bash
for i in `seq $2 $3`; do
base=$1-$i
image=${base}.jpeg
pdflist="${pdflist} \"$base.pdf\""
tesseract "$image" "$base" -l deu pdf;
done
pdfjoin $pdflist && rm $pdflist
mv "$1"-"$3"-joined.pdf "$1".pdf
I wrote and use this script to convert JPEG images (names e.g.
test-1.jpeg, test-2-jpeg, etc) to searchable pdf (names test.pdf).
However, the
pdfjoin $pdflist
isn't working when $1 contains spaces. Apparently the quotes are
disappearing somewhere along the way.
Philipp