Revision 8954
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/util.sh | ||
---|---|---|
1 | 1 |
#!/bin/bash -e |
2 | 2 |
set -o errexit # in case caller did not have -e in #! line |
3 | 3 |
|
4 |
function extern () { (unset -f "$1"; "$@") || exit; }
|
|
4 |
function extern () { (unset -f "$1"; "$@") || return; }
|
|
5 | 5 |
|
6 | 6 |
realpath () { readlink -f -- "$1"; } |
7 | 7 |
|
Also available in: Unified diff
lib/util.sh: extern (): replaced the `|| exit` after the () with `|| return`, because `|| exit` strangely does not use $? as its exit status (even though `|| exit $?` works fine). in a shell function, it is actually sufficient, for errexit purposes, to use `|| return`, because the exit status is checked upon return from the function. it is in fact preferable to use return rather than exit, because then the caller can catch the exception using `|| true`.