Let\'s say I have a script like the following:
useless.sh
echo \"This Is Error\" 1>&2 echo \"This Is Output\"
And I have an
# command receives its input from stdin. # command sends its output to stdout. exec 3>&1 stderr="$(command &1 1>&3)" exitcode="${?}" echo "STDERR: $stderr" exit ${exitcode}