Wi-Fizzle.com - Putting the fizzle in Wi-Fi since 2005 .. (yes, this was a poor choice for a domain name)

<div class="news_item">#91<div class="news_title">HOWTO: Swap stdout and stderr in BASH shell scripts

Posted by dandriff on Wednesday February 21, 2007@01:35PM

Today I found out how to switch stdout and stderr in a shell script:

 3>&2 2>&1 1>&3-

 example:
 echo "hi this will be echoed to stderr" 3>&2 2>&1 1>&3-

Originally found at: http://www.cygwin.com/ml/cygwin/2003-06/msg00775.html