On 12/24/09 3:35 PM, Krzysztof Oledzki wrote:
> Bash Version: 4.0
> Patch Level: 35
> Release Status: release
>
> Description:
> set -e (errexit) does not work in subfunctions when
> caller checks for a return result
>
> Repeat-By:
> ---cut here ---
> #!/bin/sh
>
> f() {
> set -e
> ls this-file-does-not-exist
> echo "should not hapen"
> }
>
> echo "Try #1"
> f || echo "failed"
>
> echo "Try #2"
> f
Since the first call to f takes place on the left of a `||', set -e has
is ignored during its execution, and enabling it has no effect (though,
since settings are global, it remains enabled after the function returns).
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/