On Mon, 2003-02-24 at 17:03, Michael Torrie wrote: > On Mon, 2003-02-24 at 16:48, Stuart Jansen wrote: > > > > 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.
No, it isn't. A quick test will tell you that. Likewise, it _does_ matter where you put the 2>&1. It has to to pull off more advanced tricks. (Creating new filedescriptors and using them as multiple pipes, etc.) When at all possible, I try to test before answering a question. I wouldn't have said the second solution didn't work if I hadn't seen it fail. -- [previous directory: unavailable ] [patience: /home/sjansen ] bash:sjansen()$ ls -l /root/ | grep hi 2>/dev/null ls: /root/: Permission denied [previous directory: unavailable ] [patience: /home/sjansen ] bash:sjansen()$ ls -l /root/ 2>/dev/null | grep hi [previous directory: unavailable ] [patience: /home/sjansen ] bash:sjansen()$ -- > 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? Unfortunately, I don't. If bash isn't available, sh always is. It's less advanced, but in this case good enough. -- Stuart Jansen <[EMAIL PROTECTED]> #define FALSE 0 /* This is the naked Truth */ #define TRUE 1 /* and this is the Light */ -- mailto.c ____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://phantom.byu.edu/cgi-bin/mailman/listinfo/uug-list
