Hi, FYI
It would be nice for ls to have an option so that it does not produce an error when given a non-existant file, similar to what 'rm -f' does. I've a script which does an ls on a spool directory, looking for all files that match a certain pattern. The ls output is piped to another program. When no files match, I get the error: ls: <pattern>: No such file or directory I could care less, it just means there's nothing to process. To keep there error from coming up, I can 2>/dev/null or, in my case if [ ! -e . ] ; then ls pattern ; fi but niether of these solutions is particularly elegant. The first throws all errors away, and I want to know if there are any other errors. The second assumes that there will only be files in the directory when the directory also contains files matching <pattern>. There's also: if [ -n "$(ls pattern 2>/dev/null)" ] ; then ls pattern ; fi but why? An 'ignore-non-existant-files' option seems cleanest. :-( bloat, bloat, bloat ) Sorry, I've no suggestion for what to call such an option. Really sorry, as a good name is 80% of the work. (I wish I could grep stderr and filter the "No such file or directory" error, but I don't know how to do this and still pipe the stdout ls output to another program. :-( It would still be ugly, but... ) Thanks for all the work. Karl <[EMAIL PROTECTED]> e-tattoo: Ride Hard and Die Free _______________________________________________ Bug-fileutils mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-fileutils
