In the past, I've used redirection to send output to /dev/null such as: -
foobar 2> /dev/null
where foobar is a non-existent command/binary, but I want the error output ( stderr ) such as: -
zsh: command not found: foobar
or: -
foobar: command not found
to be "hidden"
Similarly, I've used redirection to send "pukka" output ( stdout ) to also go to /dev/null e.g. : -
uptime 1> /dev/null
However, I'd not seen the simple way to do both in one fell swoop: -
foobar &> /dev/null
uptime &> /dev/null
where the ampersand ( & ) is used to send BOTH stdout and stderr to /dev/null
As ever, which is nice
No comments:
Post a Comment