Revision 8917
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/util.sh | ||
---|---|---|
1 | 1 |
#!/bin/bash -e |
2 |
function extern () { (unset -f "$1"; "$@") || exit; } |
|
3 |
|
|
2 | 4 |
realpath () { readlink -f -- "$1"; } |
3 | 5 |
|
4 |
include_guard_var () { realpath "$1"|sed 's/[^a-zA-Z0-9_]/_/g'; } |
|
6 |
include_guard_var () { realpath "$1"|"extern" sed 's/[^a-zA-Z0-9_]/_/g'; }
|
|
5 | 7 |
|
6 | 8 |
self_not_included () # usage: if self_not_included; then ... fi |
7 | 9 |
{ |
... | ... | |
24 | 26 |
|
25 | 27 |
unalias () { builtin unalias "$@" 2>&- || true; } # no error if undefined |
26 | 28 |
|
27 |
function extern () { (unset -f "$1"; "$@") || exit; } |
|
28 |
|
|
29 | 29 |
#### exceptions |
30 | 30 |
|
31 | 31 |
# usage: try cmd...; ignore status; if catch status; then ...; fi; end_try |
Also available in: Unified diff
bugfix: lib/util.sh: include_guard_var (): use extern () when invoking sed so that this internal use of it isn't verbosely logged along with other external commands. note the "" around extern to refer to the function, not the alias.