mirror of
https://github.com/rocketraman/sane-scan-pdf.git
synced 2025-05-21 01:50:10 -07:00
Fix the multi-output loop
Resolves #33. Fixes the arithmetic comparison in the while loop being incorrect. Also, handles the situation in which there are more output files being specified than scans available, in addition to the already handled reverse situation.
This commit is contained in:
parent
f9d329cf27
commit
d716cdbe8c
4
scan
4
scan
@ -283,10 +283,10 @@ if [[ $numscans > 0 ]]; then
|
|||||||
echo "Truncated $TRUNCPAGE pages"
|
echo "Truncated $TRUNCPAGE pages"
|
||||||
fi
|
fi
|
||||||
if [[ $numscans > 1 && $USEARRAY == 1 ]]; then
|
if [[ $numscans > 1 && $USEARRAY == 1 ]]; then
|
||||||
echo "Naming pdfs based on output list..."
|
|
||||||
output_count=${#OUTPUT[@]}
|
output_count=${#OUTPUT[@]}
|
||||||
|
echo "Naming $numscans pdfs based on output list of $output_count names..."
|
||||||
index=0
|
index=0
|
||||||
while [[ "$index" < "$output_count" ]]; do
|
while (( $index < $output_count && $numscans > $index )); do
|
||||||
let "scanno = $index + 1"
|
let "scanno = $index + 1"
|
||||||
if [[ -f "${OUTPUT[$index]}" ]]; then
|
if [[ -f "${OUTPUT[$index]}" ]]; then
|
||||||
mv "${OUTPUT[$index]}" "${OUTPUT[$index]}.orig"
|
mv "${OUTPUT[$index]}" "${OUTPUT[$index]}.orig"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user