Re: grep crashes machine
Frodo Baggins wrote:
> Christian Pernegger scripsit:
> >Hallo!
> >
> >I just stumbled upon the following. If I do
> >
> ># cd /
> ># grep -r * stuff
> >
> >it outputs files for maybe half a second then hangs the whole machine. The
> >last matches were under /dev. I can't remember grep ever scanning device
> >files, but maybe it's just me...
> are you shure? shouldn't be
>
> # grep -r stuff *
>
> ?
>
> Anyhow... It will have a problem when grep-ing never endig devices
> such as /dev/zero.....
Right, so something a little better might be
find / -type f -exec grep stuff {} \; -print
That way you only grep on regular files. You might even want to throw in a -xdev to
keep from going through /proc.
--
Jens B. Jorgensen
jens.jorgensen@cmgisolutions.com
Reply to: