On Tue, 18 Nov 2003, Lyle Chapman wrote: > I have a small script that monitors a particular folder and then > forwards files for printing, can anybody show me how to suppress error > messages and only display certain messages like "Looking for files to > print" and "Files found! Preparing to print" or something along those > lines and make it loop forever?
For the lines that are printing errors to the monitor, put in 2>/dev/null at the end of the line. Basically this directs error messages to the universal garbage bin (/dev/null) while putting other messages out to the screen. You can test that a command has executed correctly by looking at the value of $?. If there were no errors then it returns 0. You could use this to determine whether to print the messages Files Found! etc. etc. If I understand you correctly you could do something like:- ls/home/user/workflow/Proofers/A4/*.pdf 2>/dev/null if [ $? -eq 0 ] ; then echo "Files Found!!" lp -d brothers /home/user/workflow/Proofers/A4/*.pdf 2>/dev/null if [ $? -eq 0 ] ; then echo "Files Printed!!" fi fi cheers, Bernard Doyle > > #!/bin/sh > #Looping .pdf script > > do > echo looking for file to print > lp -d brothers /home/user/workflow/Proofers/A4/*.pdf > lp -d xeroxq /home/user/workflow/Proofers/A3/*.pdf > rm /home/user/workflow/Proofers/A4/*.pdf > rm /home/user/workflow/Proofers/A3/*.pdf > sleep 15 > done > > If anyone could help out I would appreciate it, my programming and > scripting skills are basically zero. > > > > Lyle Chapman > > Pre-Press Supervisor > Torch Publishing Co. > 47 Allingham Street, Condell Park 2200, NSW, Australia > 612 9795 0000 > http://www.torchpublishing.com.au > -- > SLUG - Sydney Linux User's Group - http://slug.org.au/ > More Info: http://lists.slug.org.au/listinfo/slug > -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug