Re: Printing Informix reports to HP Laser Jet
Posted in 1992
Topics: General Discussion
I usually don't include a "report to" section in my reports. I let the output go to standard out. At the standout I redirect the output to the attached shell scripts. #ident "@(#) report.sh 1.4.0 04/09/91 " # general INFORMIX report print routine # usage: report.sh sacego {-q} reportname # Additional features # a) option to print to a UNIX spool Printer ( lp -d{printer} # b) print to locally attached printer # c) "print" to screen, piped through pg command # d) "print report" to ATTMail!fax # e) "print report" to E-Mail # f) Select your default printer # while : do tput clear echo "************************************************************************" echo "* PRINTING *" echo "* *" echo "* Do you want this to go to: ** 1 UNIX Spool Printer ** *" echo "* ** 2 Local Printer ** *" echo "* ** 3 Screen ** *" echo "* ** 4 ATTMail!fax ** *" echo "* ** 5 E-Mail ** *" echo "* ** 6 Select A Default Printer *" echo "* *" echo "************************************************************************" echo " Enter appropriate Number: \\c" read answ1 if [ $answ1 != "6" ] then if [ $1 = "-ol" ] then opt=$1 shift fi $*>/usr/tmp/tmp$$ fi case "${answ1}" in 1) if [ -z "$opt" ] then echo "Landscape or Portrait (L/P) \\c" read prtans if [ "$prtans" = "L" -o "$prtans" = "l" ] then opt="-ol" else opt="" fi fi if [ -z "$LPDEST" ] then if [ ! -f $HOME/.lastprinter ] then LPDEST=`lpstat -d|cut -d: -f2` else LPDEST=`cat $HOME/.lastprinter` fi fi export LPDEST echo "Input name of printer (i.e. 495_1408 or <cr> for default)" echo "Your default is set to \\"lp -d$LPDEST $opt\\"\\n" read answ2 if [ -z "$answ2" ] then lp -c $opt -d$LPDEST /usr/tmp/tmp$$ 1>/dev/null echo "Report has been sent to the $LPDEST printer" else lp -c $opt -d$answ2 /usr/tmp/tmp$$ 1>/dev/null echo "Report has been sent to printer $answ2" fi sleep 3 break;; 2) if [ $TERM = "4410" ] then p_on="\\033[?s" #4410 Terranova p_off="\\033[?e" stty cs8 elif [ $TERM = "605" ] then p_on="\\033[5i" #605 Terranova p_off="\\033[4i" stty cs8 elif [ $TERM = "510" ] then p_on="\\033[?5i" #510 jelly screens p_off="\\033[?4i" else p_on="\\033[5i" #ansi 3.64 terminals p_off="\\033[4i" fi tput clear echo "\\n\\n\\t\\tMake sure you printer is ready to print.." echo "\\n\\n\\t\\tPress any key to start \\c" read xxx echo $p_on pr -t /usr/tmp/tmp$$ echo "\\f" echo $p_off break;; 3) pg /usr/tmp/tmp$$ break;; 4) while : do echo "Enter FAX Number (i.e. 14045551212) : \\c" read fnum echo "Enter the ATTENTION name : \\c" read anam if [ -z $fnum ] then continue else break fi done echo "To: attmail!fax!$fnum (/$anam)">/usr/tmp/tmp1$$ echo "\\n">>/usr/tmp/tmp1$$ cat /usr/tmp/tmp$$>>/usr/tmp/tmp1$$ mail attmail!dispatcher </usr/tmp/tmp1$$ echo "Would YOU like a copy also ? (y/n) \\c" read cop1 if [ $cop1 = "Y" -o $cop1 = "y" ] then mail $LOGNAME</usr/tmp/tmp$$ fi break;; 5) while : do echo "Enter ATTMail Id to send report to : " echo "(It may contain a machine id also " echo "i.e. bsm9gg9!id \\c" read mid if [ -z $mid ] then continue else mail "$mid" < /usr/tmp/tmp$$ break fi done echo "Would YOU like a copy also ? (y/n) \\c" read cop1 if [ $cop1 = "Y" -o $cop1 = "y" ] then mail $LOGNAME</usr/tmp/tmp$$ fi break;; 6) echo "\\t\\t**********************************" echo "\\t\\t* *" echo "\\t\\t* Your Available Printers are: *" echo "\\t\\t* *" echo @@D