Michael Lake <[EMAIL PROTECTED]> writes:

> echo "looking for A3 files to print"
> for files in $Source_A3/*.pdf ; do
>       lp -d xeroxq $file
>       mv $file $Backup_A3
> done

This is a better way of doing it. But I think it's vulnerable to
overflowing the argument list buffer, not sure about file names with
funny characters in them, I think if a file name had a carriage return
in it, it might not work, don't know. 

> 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


This has a few bugs which might not be obvious to some, it's also
vulnerable to overflowing the argument list buffer plus new files could
appear just after the lp -d line is expanded and run, but before the rm
is expanded and run, so files could be deleted without being printed.
It's no big deal for this application, just a minor inconvenience, it
can be avoided using Michaels example above.

I would also be wary about making the rm conditional to the success of
lp, if lp partially works, spools part of the job and then fails, (I
have no idea if lp could do that) you might end up repeatedly spooling
the same broken pdf.





-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to