- To: james@xxxxxxxxxxxxxxxx
- Subject: Re: [SLUG] recursive tree log grep ?
- From: Glen Turner <glen.turner@xxxxxxxxxxxxx>
- Date: Mon, 23 May 2005 13:15:54 +0930
- Cc: SLUG <slug@xxxxxxxxxxx>
- Organization: Australia's Academic & Research Network
- User-agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513)
for DIR in `ls -d /home/*`
do
grep -R a-string $DIR/logs/
done
James
Fyi, you can do this with the ls.
for dir in /home/*
do
if [ -d $dir ]
then
...
fi
done
In a real-world script you might also say
"${dir}"
rather than
$dir
to allow nasty filenames.