#!/bin/bash # Copyright (C) 2008-2018 Richard Kimberly Heck # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Updates etc should be available from: # http://frege.brown.edu/heck/linux/programs/bash.php # Change log # Version 0.1: First public release PROG=`basename $0`; DEVICE="hp5590:libusb:001:006"; function printUsage { cat </dev/null); if [ -z "$CVT" ]; then echo "This script uses the scanimage utility from the sane-backends package. It does not appear to be in your path."; exit 1; fi if [ -n "$1" ]; then FILENAME="$1"; else FILENAME="pages"; fi TDIR="$FILENAME-$$"; TMPDIR="/tmp/$TDIR"; if [ -e "$TMPDIR" ]; then echo $TMPDIR exists!; exit 1; fi $DEBUG scanimage -d $DEVICE --mode $MODE --format=$EXT --batch=$FILENAME%d.$EXT $PAGENUMS $BATCH -p -y $PAPLEN --source ADF --resolution $REZ $QUIET; if [ -n "$DEBUG" ]; then exit 0; fi for i in $FILENAME?.$EXT; do if [ -e "$i" ]; then mv $i ${FILENAME}00${i#$FILENAME}; fi done for i in $FILENAME??.$EXT; do if [ -e "$i" ]; then mv $i ${FILENAME}0${i#$FILENAME}; fi done exit 0;