aboutsummaryrefslogtreecommitdiff
path: root/scan.sh
diff options
context:
space:
mode:
authorNat Lasseter <nat.lasseter@york.ac.uk>2024-01-22 10:23:58 +0000
committerNat Lasseter <nat.lasseter@york.ac.uk>2024-01-22 10:23:58 +0000
commita79414bcf14d17c58e040a7b8524f7bd8f7e5e03 (patch)
tree4f2f232aca568711ecb35caa3444b54f4dfa4361 /scan.sh
Migrate from gists
Diffstat (limited to 'scan.sh')
-rw-r--r--scan.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/scan.sh b/scan.sh
new file mode 100644
index 0000000..ecb505c
--- /dev/null
+++ b/scan.sh
@@ -0,0 +1,37 @@
+#!/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