2019-01-26 21:36:28 +0100, Philipp Klaus Krause:
[...]
Use an array variable to store more than one value.
#! /bin/bash -
pdflist=()
for ((i = $2; i <= $3; i++)) {
base=$1-$i
image=$base.jpeg
pdflist+=("$base.pdf")
tesseract "$image" "$base" -l deu pdf
}
pdfjoin "${pdflist[@]}" && rm "${pdflist[@]}"
mv "$1-$3-joined.pdf" "$1.pdf"
Note that it won't work properly if $1 starts with "-". The
way to address it would be to use "--" for all commands, but
unfortunately it won't work with pdfjoin which calls pdfjam,
itself a Bourne-shell script that breaks when file names start
with "-" even if you pass "--" to pdfjoin.
One way to address it would be to prefix relative paths with
"./".
case $1 in
(/*) prefix=$1;;
(*) prefix=./$1;;
esac
--
Stephane