#!/bin/sh echo "Enter output file name" read OUT_FILE #scan a batch scanimage --format pnm --batch --batch-prompt --resolution 300 --mode Gray #convert the raw file to postscript convert -density 300 *.pnm out.ps #convert the postscript to pdf ps2pdf out.ps $OUT_FILE.pdf #remove raw scan files rm *.pnm #remove old ps files rm out.ps