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: Chet Ramey
Subject: Re: triggering of ERR trap differs between bash 3.2.39 & 4.0.28
Date: Sun, 08 Nov 2009 21:57:38 -0500
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

Amit Dor-Shifer wrote:

> cm.stargate ~ # bash -xc 'set -eE;on_error() { echo ERROR ERROR; };trap
> on_error ERR;if [ -n "$(echo $0 |grep a)" ];then echo "input contains
> 'a'";fi' b
> + set -eE
> + trap on_error ERR
> ++ echo b
> ++ grep a
> +++ on_error
> +++ echo ERROR ERROR
> + '[' -n 'ERROR ERROR' ']'
> + echo 'input contains a'
> input contains a
> </bash-4>

I can't reproduce it with bash-4.0.35:

$ ../bash-4.0-patched/bash -xc 'set -eE;on_error() { echo ERROR ERROR;
};trap on_error ERR;if [ -n "$(echo $0 |grep a)" ];then echo "input
contains 'a'";fi' b
+ set -eE
+ trap on_error ERR
++ echo b
++ grep a
+ '[' -n '' ']'
$ ../bash-4.0-patched/bash --version
GNU bash, version 4.0.35(9)-release (i386-apple-darwin10.0.0)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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