Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing from a line command

Status
Not open for further replies.

jalge2

Technical User
Feb 5, 2003
105
US
First of all, here's my script +1 # /bin/ksh!
+2
+3 echo "\tPlease enter the battery number you wish to search for..."
+4 read ans
+5
+6 if [[ $ans != 0 ]]
+7
+8 then
+9 cat /dso/eis/log/batlog.log.* |grep $ans
+10 fi
+11
+12 echo "\tWould you like to print this? (y/n)"
+13 read ans1
+14
+15 if [ $ans1 = "y" -o $ans1 = "Y" ]
+16
+17 then
+18 lp -dpcl@pr7
+19
+20 else
+21 exit
+22 fi
~

When I run this, it just hangs out there and nothing prints. Am I doing something wrong?
 
I would do something like this, grep that batlog.log to a file and print that file.



+1 #/bin/ksh!
+2
+3 echo "\tPlease enter the battery number you wish to search for..."
+4 read ans
+5
+6 if [[ $ans != 0 ]]
+7
+8 then
+9 cat /dso/eis/log/batlog.log.* |grep $ans > /tmp/file_to_print
+10 fi
more /tmp/file_to_Print | head
+11
+12 echo "\tWould you like to print this? (y/n)"
+13 read ans1
+14
+15 if [ $ans1 = "y" || $ans1 = "Y" ]
+16
+17 then
+18 qprt -v8 -l80 -p17 - Pprinter_name /tmp/file
+19
+20 else
+21 exit
+22 fi
rm /tmp/file_to_print
 
qprt -v8 -l80 -p17 - Pprinter_name /tmp/file

should be

qprt -v8 -l80 -p17 - Pprinter_name /tmp/file_to_print
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top