[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: |
Mon, 9 Nov 2009 08:47:04 -0500 |
> Ok. Same here. (4.0.35 is not yet stable on my distro, gentoo, hence I
> quoted results with 4.0.28).
But I can't reproduce it with bash-4.0.28, either:
$ ./bash --version
GNU bash, version 4.0.28(2)-release (i386-apple-darwin9.8.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.
$ ./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' a
+ set -eE
+ trap on_error ERR
++ echo a
++ grep a
+ '[' -n a ']'
+ echo 'input contains a'
input contains a
$ ./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 '' ']'
--
``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/