[wplug] bash script need help
Tom Rhodes
trhodes at FreeBSD.org
Wed Dec 5 01:01:40 EST 2007
On Mon, 03 Dec 2007 18:30:40 -0500
Brian Gollum <brig at cmu.edu> wrote:
> > 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
Or put them in a list with "ls" and chomp it with
set -- `ls`;
do whatever to $1
shift
--
Tom Rhodes
More information about the wplug
mailing list