| jan95.tar |
Listing 1: prq--A printer queue manager
################################################## # # This is a simple script to check the printer # queue for each printer on the system and # give the user the option to remove any print # job that they may own. And provide the super- # user with quick interface to move print jobs # on the queue. # # Programmer: Robert Berry # Date: 7/14/94 # ################################################## # # Variable names: # ans..........used to accept y/n response # prntr........used to accept printer selection # jobnum.......used to accept job to delete # HOME.........used to see if user is super-user # ################################################## echo " ********** Laser 2 ***********" lpq -Plaser2 echo " " echo " ********** Laser 3 ***********" lpq -Plaser3 echo " " echo " ********** PaintJet **********" lpq -Ppaintjet echo " " echo " ********** Plotter ***********" lpq -Php echo " " echo "===========================================" echo "===========================================" echo -n "Would you like to remove jobs? (y/n)" read ans ########### First if statement ########### if [ $ans = "y" ] then ########### While loop ############ while [ $ans = "y" ] do echo " " echo " Remove jobs on..." echo " 1) Laser 2" echo " 2) Laser 3" echo " 3) PaintJet" echo " 4) Plotter" echo " -----------------------" echo " 5) List all jobs again" echo " 6) Rearrange print jobs" echo " 7) Exit" echo -n " Enter your choice: " read prntr clear ############# Case statement ############ case $prntr in 1) echo -n "Enter job number or '-' to remove all:" read jobnum lprm -Plaser2 $jobnum;; 2) echo -n "Enter job number or '-' to remove all:" read jobnum lprm -Plaser3 $jobnum;; 3) echo -n "Enter job number or '-' to remove all:" read jobnum lprm -Ppaintjet $jobnum;; 4) echo -n "Enter job number or '-' to remove all:" read jobnum lprm -Pdm $jobnum;; 5) echo " ********** Laser 2 ***********" lpq -Plaser2 echo " " echo " ********** Laser 3 ***********" lpq -Plaser3 echo " " echo " ********** PaintJet **********" lpq -Ppaintjet echo " " echo " ********** Plotter ***********" lpq -Php echo " " echo "====================================" echo "====================================";; ############ Second menu level ############ 6) if [ $HOME = "/" ] then ans=n ############# While loop ############ while [ $ans = "n" ] do echo " " echo " Move jobs on..." echo " 1) Laser 2" echo " 2) Laser 3" echo " 3) PaintJet" echo " 4) Plotter" echo " -----------------------" echo " 5) List all jobs again" echo " 6) Back one menu" echo " 7) Exit" echo -n " Enter your choice: " read prntr clear ####### Second set of case options ####### case $prntr in 1) echo -n "Enter job(s) or user name(s): " read jobnum lpc topq laser2 $jobnum;; 2) echo -n "Enter job(s) or user name(s): " read jobnum lpc topq laser3 $jobnum;; 3) echo -n "Enter job(s) or user name(s): " read jobnum lpc topq paintjet $jobnum;; 4) echo -n "Enter job(s) or user name(s): " read jobnum lpc topq hp $jobnum;; 5) echo " ********** Laser 2 ***********" lpq -Plaser2 echo " " echo " ********** Laser 3 ***********" lpq -Plaser3 echo " " echo " ********** PaintJet **********" lpq -Ppaintjet echo " " echo " ********** Plotter ***********" lpq -Php echo " " echo "=================================" echo "=================================";; 6) ans=y;; 7) clear exit;; x) clear exit esac done ######### If user isn't super-user ######### else echo " " echo "You must be Super User for this option" fi;; 7) clear exit;; x) clear exit esac done else exit fi ##################### THE END ########################
|