Listing 4: Massaging a non-PostScript file
#!/bin/sh
# tray_ps1.sh
# Script to test if the file is PostScript. If the file is not PostScript
# convert the file to PostScript using enscript. Then use the C program
# tray2 to add a line of PostScript which selects the second tray.
BINDIR=/usr/local/bin
PATH=$BINDIR:/bin:/usr/bin:/usr/ucb:/usr/local/lib/ts
export PATH
if [ 'cat - | line | grep -c "%!" ' !=0 ]
then
cat - | tray2 | lpr -Pps1
else
cat - | enscript -q -p /var/spool/ps1b_lp/ps_temp_file
cat /var/spool/ps1b_lp/ps_temp_file | tray2 | lpr -Pps1
rm /var/spool/ps1b_lp/ps_temp_file
fi
exit
|