Fwd: Bug when trapping exit from subshell

2014-05-19 Thread Mark Ferrell
On Mon, May 19, 2014 at 10:45 AM, Greg Wooledge wrote: > 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_

Re: Bug when trapping exit from subshell

2014-05-19 Thread Greg Wooledge
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

Re: Bug when trapping exit from subshell

2014-05-19 Thread Mark Ferrell
I stand corrected. After adding a 'touch' to the script, it does indeed appear to be calling the exit handler. So it the redirection of the output to the error handler only happens if a builtin/function failed (error on an external command does not result in a redirection), and this behaviour is

Re: Bug when trapping exit from subshell

2014-05-19 Thread Chet Ramey
On 5/18/14, 12:56 PM, Mark Ferrell wrote: > I believe that if you actually execute the script as intended you will > find that your reading of the code is incorrect. Really though, > redirection should not be the problem since: > > 1. Redirection of the output of one command does not change the