how to grep error messages

Soren Orel soren.orel at gmail.com
Sun Jun 28 09:39:55 UTC 2009


I can /dev/null the error messages like:

cd "$1" 2> /dev/null

e.g.: I get error If "$1" has spaces in it

Ok, but how can I grep the error message? I tried:

if cd "$1" 2> grep -i "No such file or directory"; then echo "badbadbad";
exit; fi

But it doesn't work :S

thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090628/f6368488/attachment.html>


More information about the ubuntu-users mailing list