[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug when trapping exit from subshell

From: Greg Wooledge
Subject: Re: Bug when trapping exit from subshell
Date: Mon, 19 May 2014 13:45:53 -0400
User-agent: Mutt/

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

[Prev in Thread] Current Thread [Next in Thread]