Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] recursive tree log grep ?



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.