In scripts, errors are usually sent to file descriptor 2 with &2, ie:
echo "error" >&2
Sometimes /dev/stderr is used instead:
echo "error" > /dev/stderr
Looking at /dev/stderr, I see that it is only a symlink to /proc/self/fd/2 , which in turn is a symlink to /dev/pts/5 (on my current terminal).
Seems little bit over complicated. Is there some logic behind that ?
Is using /dev/stderr and &2 equivalent ?
Is any of those preferred over the other ?
echo "error" >2creates a file with name2and contenterror.>2, or>&2?