//Random Tip
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow

You are viewing a random entry, refresh your browser to change.

Perform a recursive grep of the Solaris /etc directory, bypassing those nasty sockets Sun keeps in there:
grep foobar `find /etc/* -type f -print`


View Comments »




Comments 

Add your comment

Comments are currently disabled
several problems there, the most relevant is that filenames with newlines and/or spaces (that are perfectly valid) will make it crash.

better use find's "exec" that uses {} as a replacement of the filename and it's safe (don't forget to add ';' at the end):

 find /etc -type f -exec grep foobar {} ';'

also find is recursive by default, no need to expand /etc/* when /etc will do.
Posted 2009-02-06 18:53:53

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit