Skip to content

Instantly share code, notes, and snippets.

@User4574
Last active September 7, 2023 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save User4574/ff89aa301eb893b20a18e5b5ce8c6019 to your computer and use it in GitHub Desktop.
Save User4574/ff89aa301eb893b20a18e5b5ce8c6019 to your computer and use it in GitHub Desktop.
Batch scanning script
#!/bin/bash
function scanpage {
echo -n insert $1 and press return
read
scanimage \
-d 'brother5:bus2;dev2' \
--AutoDocumentSize=yes \
--format=pdf \
--resolution 300 \
--AutoDeskew=yes \
-o $1 2>/dev/null
}
if [[ -z $1 ]] ; then
echo -n 'prefix ?'
read pref
[[ -z $pref ]] && exit
else
pref=$1
shift
fi
if [[ -z $1 ]] ; then
while true ; do
echo -n 'document#(s) ?'
read n
[[ -z $n ]] && exit
for j in $n ; do
scanpage ${pref}-$j.pdf
done
done
else
for j in $* ; do
scanpage ${pref}-$j.pdf
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment