[wplug] bash script need help

Brian Gollum brig at cmu.edu
Mon Dec 3 18:30:40 EST 2007


> Anyone know how I can make
> this script work on any logfile so I can do: email-script.sh foo

for f in $@
do
     if [ -f $f ]
     then
         grep @ $f | ....
     else
         echo "$0: $f not found"
     fi
done

The above will process multiple files, one at at time, verifying each 
file exists before processing it. Or, you can drop the for, do and done 
lines, and use $1 in place of $f to process a single file:

if [ -f $1 ]
then
     grep @ $1 | ....
else
     echo "$0: $1 not found"
fi

...b.



More information about the wplug mailing list