bug-bash
[Top][All Lists]
Advanced

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

Re: triggering of ERR trap differs between bash 3.2.39 & 4.0.28


From: pk
Subject: Re: triggering of ERR trap differs between bash 3.2.39 & 4.0.28
Date: Sun, 08 Nov 2009 13:20:20 +0000

Amit Dor-Shifer wrote:

> I've the following script:
> 
> set -eE
> on_error() { echo ERROR ERROR; }
> trap on_error ERR
> 
> if [ -n "$(echo $1 |grep a)" ];then
>    echo "input contains 'a'"
> fi
> 
> When executed under bash-4, on_error is evaluated as part of the
> expression in the 'if'. This does not happen in 3.2:

I think this is part of the new behavior of -e in bash 4. See for example 
here:

http://www.mail-archive.com/bug-bash@gnu.org/msg06288.html



reply via email to

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