On Mon, 2003-02-24 at 16:48, Stuart Jansen wrote: > On Mon, 2003-02-24 at 12:17, Michael Ryan Byrd wrote: > > So I decide I want to show all the index.html files on my system with: > > > > ls -alR |grep "index.html" > > > > (I could have used 'Find . -name "index.html" -print', but anyway.) > > > > The problem is that this command is not executed as root, so I'm going to get a > > bunch of errors like: > > Two solutions have already been given. However, I personally think the cleanest is > > ls -alR 2>/dev/null | grep "index.html"
That's the exact same as ls -alR | grep "index.html" 2> /dev/null. In either case grep doesn't process standard error. It really doesn't matter where on the commandline you put the 2> /dev/null. I don't think it matters where you put 2>&1 either if you really need to parse the error stream. Note that in the case of the original poster he's using csh, which doesn't have the same syntax for redirection and thus 2> is illegal. Anyone know how to do it? Michael > > Unless there's a reason to send errors through the pipe and burn CPU > processing them, why not kill it right away? As for the other, it's > only eating grep's stderr but you want get rid of the ls' error > messages. -- Michael Torrie <[EMAIL PROTECTED]> ____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://phantom.byu.edu/cgi-bin/mailman/listinfo/uug-list
