[PLUG] Bash file test for multiple files

2011-02-11 Thread Michael Rasmussen
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

Re: [PLUG] Bash file test for multiple files

2011-02-11 Thread Alex Young
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 mich...@jamhome.us 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

Re: [PLUG] Bash file test for multiple files

2011-02-11 Thread Michael
Alex Young wrote: Here's what I use: DIRTOTAL=`ls $PATH | grep [^*$] -c` if [ $DIRTOTAL -ne 0 ]; then That works. On Feb 11, 2011, at 6:14 AM, Michael Rasmussen mich...@jamhome.us wrote: Goal: to execute a block if one or more files exists bash file test -e will tell you if a

Re: [PLUG] Bash file test for multiple files

2011-02-11 Thread Paul Heinlein
On Fri, 11 Feb 2011, Alex Young wrote: Here's what I use: DIRTOTAL=`ls $PATH | grep [^*$] -c` if [ $DIRTOTAL -ne 0 ]; then if test $(find $DIR -type f | wc -l) -gt 0; then # whatever fi -- Paul Heinlein heinl...@madboa.com http://www.madboa.com/