[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
set -e loses exit status
From: |
Dennis Lambe Jr. |
Subject: |
set -e loses exit status |
Date: |
Mon, 10 Mar 2014 14:32:46 -0400 |
User-agent: |
Internet Messaging Program (IMP) H3 (4.3) |
When set -e is in effect in a subshell, the exit status of commands,
functions, and sub-subshells is converted to 1.
$ ( ( exit 75 ) ); echo $?
75
$ (set -e; ( exit 75 ) ); exit $?
1
Versions of bash prior to 4.1 didn't convert all exit statuses to 1
when set -e was in effect.
$ uname -a
Linux malsyned 3.5.0-46-generic #70-Ubuntu SMP Wed Jan 8 18:43:34 UTC
2014 i686 i686 i686 GNU/Linux
$ bash-4.0/bash -c 'echo $BASH_VERSION; (set -e; (exit 75) ); echo $?'
4.0.0(1)-release
75
$ bash-4.1/bash -c 'echo $BASH_VERSION; (set -e; (exit 75) ); echo $?'
4.1.0(1)-release
1
I don't know what the relevant standards are governing this behavior,
but dash and busybox sh both match the pre-4.1 behavior.
- set -e loses exit status,
Dennis Lambe Jr. <=