[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
set -e (errexit) does not work in subfunctions when a return result is c
From: |
Krzysztof Oledzki |
Subject: |
set -e (errexit) does not work in subfunctions when a return result is checked |
Date: |
Thu, 24 Dec 2009 21:35:53 +0100 (CET) |
User-agent: |
Alpine 1.10 (LNX 962 2008-03-14) |
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: i686-pc-linux-gnu-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
-DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin'
-DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout'
-DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -march=prescott -O2 -pipe
-fomit-frame-pointer
uname output: Linux wrestler 2.6.28.10-o3 #1 SMP PREEMPT Wed Jul 8 15:29:42
CEST 2009 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz GenuineIntel GNU/Linux
Machine Type: i686-pc-linux-gnu
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
--- cut here ---
- set -e (errexit) does not work in subfunctions when a return result is checked,
Krzysztof Oledzki <=