#!/bin/bash # Simple print script # John W. Yancey 07/12/1997 # copyright (c)-1997: JYancey (jyancey@acm.org) # Send complaints to "/dev/null" # Set up some printing defaults outfile="FALSE" opt="-1GR" bfont="-fCourier8" hfont="-FCourier-Bold10" # Read in options from command line. while getopts "lpLPfh" optin; do case $optin in l ) opt="-2Gr -Picl2" ;; p ) opt="-1GR -Picl2" ;; L ) opt="-2Gr -Picl2_duplex" ;; P ) opt="-1GR -Picl2_duplex" ;; f ) outfile="TRUE" ;; h ) echo 'usage: aprint [-lpLPf] ' echo 'Options: l = One sided Landscape.' echo ' p = One sided Portrait.' echo ' L = Two sided Landscape.' echo ' P = Two sided Portrait.' echo ' f = Create Output file.' echo ' h = This help screen.' exit 1 ;; /? ) echo 'No such option, try -h for help.' esac done shift $(( $OPTIND -1 )) if [ -z $1 ]; then echo 'What do you want man, I need a filename? Try -h for help.' exit 0 fi # Now get the file name file=$1 # Check for output file flag, and print to file. if [ $outfile = "TRUE" ]; then enscript $opt $bfont $hfont -p$file.ps $file else # Really print the thing now to the printer. enscript $opt $bfont $hfont $file fi