Linux: stderr bash ?

echo "wrong" >> Stderr

Is this the way to redirect to Stderr? Is this correct?

Thank you!
LVL 1
g0allAsked:
Who is Participating?
 
woolmilkporcConnect With a Mentor Commented:
Standard error is traditionally bound to file descriptor 2, in shell terms "&2"

So writing output to stderr looks like this:

echo "wrong" >&2

If you put the above in a script, let's say "myscript" and run

myscript 2>/dev/null

you will see nothing on your terminal, because the output you wrote to stderr gets redirected to /dev/null this way.
0
 
g0allAuthor Commented:
Thanks wmp!
0
All Courses

From novice to tech pro — start learning today.