Skip to content

Instantly share code, notes, and snippets.

@btm
Created August 14, 2013 17:35
Show Gist options
  • Save btm/6233398 to your computer and use it in GitHub Desktop.
Save btm/6233398 to your computer and use it in GitHub Desktop.
Using grep against STDERR
# This error goes to STDERR
$ asdfasdf
-bash: asdfasdf: command not found
# We redirect STDERR to STDOUT, but STDOUT to null, so we can use grep against STDERR
$ asdfasdf 2>&1 >/dev/null | grep -q not ; echo $?
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment