[PLUG] Bash file test for multiple files
Michael Rasmussen
michael at jamhome.us
Fri Feb 11 14:13:54 UTC 2011
Goal: to execute a block if one or more files exists
bash file test -e will tell you if a single file exists but
if [ -e ~/Maildir/.aspambin/cur/* ]; then
will croak with "too many arguments" if there is more than one file
conversly a construct like
for S in ~/Maildir/.aspambin/cur/*
will attempt to act on a file named * if the directory is empty.
So before I go convert this to Perl and for the learning
What kind of bash/shell script contruct works on 0, 1, or more files?
--
Michael Rasmussen, Portland Oregon
Trading kilograms for kilometers since 2003
Be appropriate && Follow your curiosity
http://www.jamhome.us/
The Fortune Cookie Fortune today is:
Steph, overwhelmed by the unfailing enthusiasm of Americans, covered
her face with her hands and moaned: "Oh, stop being so fucking cheerful!"
~ Cross country bike tourist Leo Woodland
More information about the PLUG
mailing list