On Mon, May 19, 2014 at 10:39:59AM -0700, Mark Ferrell wrote:
> I'm sorry, but the lack of consistency still sounds like it is a bug
> in bash.  The behaviour I would expect is functionally equivalent to
> 'do_cmd > /dev/null 2>&1 || err_handler'.  Further more, this IS the
> behaviour seen if the command being executed is NOT a
> builtin/function.

I won't take sides on that particular issue, but as a workaround, could
you use something like this?

exec 8>&1 9>&2     # Save original stdout & stderr for use in error handler
err() { echo "${1:-Error}" >&9; }

Reply via email to