Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.2016.08.31.stream-redirection
2016.08.31.stream-redirection
# no redirection
$ echo 'hello'
hello
# redirects standard error (no error in this case)
$ echo 'hello' 2> /dev/null
hello
# redirects standard out to /dev/null (so no output)
$ echo 'hello' 1> /dev/null
# redirects everything to /dev/null (so no output)
$ echo 'hello' &> /dev/null
# no redirection (causing error)
$ unlink unexisting-file.sh
unlink: unexisting-file.sh: No such file or directory
# redirects standard error to /dev/null (so no error)
$ unlink unexisting-file.sh 2> /dev/null
# redirects everything to /dev/null (so no error)
$ unlink unexisting-file.sh &> /dev/null
<operation> [n]> /dev/null [options]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.