Here's what I use:

DIRTOTAL=`ls $PATH | grep [^*$] -c`
if [ $DIRTOTAL -ne 0 ]; then


-Alex


On Feb 11, 2011, at 6:14 AM, Michael Rasmussen <[email protected]> wrote:

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
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to