I'm a bit confused as to why when I'm redirecting the standard output of an echo command to the standard error, why I still get the argument printed in the terminal?
Here's is the line I ran
echo "potato" >&2
Could someone explain this to me? How does this command output anything, if the output was redirected somewhere else?
Thank you :)
Well, by default, your terminal shows both STDOUT and STDERR.
So, what you are seeing is STDERR.
If you want to hide STDERR:
echo "potato" 2>/dev/null >&2
/dev/null
is a black-hole, where you can redirect stuff you have no wish to see :)