IO Redirection – Swapping stdout and stderr
% (sh myscript.sh 3>&2 2>&1 1>&3) 2>/dev/null I’m stderr % (sh myscript.sh 3>&2 2>&1 1>&3) >/dev/null I’m stdout Explanation of 3>&2 2>&1 1>&3: 3>&2 means make a copy of file descriptor 2 (fd 2) (stderr), named fd 3 (file descriptor 3). It copies the file descriptor, it doesn’t duplicate the stream as tee does. 2>&1 … Read more