UNIX



1. : 2 # @(#) pall v1.0 Print all files in a tree Author: Russ Sage 2

4 if [ $# -eq 0 -o $# -gt 2 ] 5 then echo "pall: wrong argument count" >&2 6 echo "usage: pall [-t|-d] dir" >&2 7 echo " -t text (default)" >&2 8 echo " -d dev (.c,.h,.mk,.s)" >&2 9 exit 1 10 fi

12 NAME="" 13 if [ `echo $1 | cut -c1` = "-" ] 14 then case $1 in 15 -t) NAME="" 16 shift;; 17 -d) NAME="-name \"*.[chms]*\"" 18 shift;; 19 *) echo "pall: invalid arg $1" >&2 20 echo "usage: pall [-t|-d] dir" >&2 21 echo " -t text (default)" >&2 22 echo " -d dev (.c,.h,.mk,.s)" >&2 23 exit 1;; 24 esac 25 fi

27 echo "creating output file: /tmp/lpr$$"

29 eval find $1 -type f $NAME -print | sort | while read FILE 30 do 31 if file $FILE | 32 egrep 'exec|data|empty|reloc|cannot open' >/dev/null 2>&1 33 then continue 34 else file $FILE > /dev/tty 35 pr $FILE 36 fi 37 done >> /tmp/lpr$$

39 echo "\nSend /tmp/lpr$$ to line printer (y/n): \c" 40 read CMD 41 if [ "$CMD" = "y" ] 42 then lpr /tmp/lpr$$ 43 fi