From: pjb@... (Pascal J. Bourguignon) Date: 2009-01-09T21:29:39+09:00 Subject: Re: A quick Mac OSX question Albert Schlef writes: > Does mac osx supports the "2>&1" syntax to redirect stderr? > > In other words, does the following line of code work as expected in mac > osx? > > output = `some_command 2>&1` As long as you use bash instead of tcsh, yes. bash -c ' output = `some_command 2>&1` ; echo "$output" ' Notice than nowdays we can use $(some_command 2>&1) instead of the backquotes, which is nice because you can nest them: bash -c ' msg=$(printf "%dnd result = %s" $(( 1 * 2 * 3 * 7 )) "$(echo "Do not panic")" ) ; echo "$msg" ' 42nd result = Do not panic Or use chsh to switch to bash: http://www.macshadows.com/kb/index.php?title=Changing_your_shell_on_Mac_OS_X -- __Pascal Bourguignon__