Revision 12803
Added by Aaron Marcuse-Kubitza almost 11 years ago
util.sh | ||
---|---|---|
240 | 240 |
function try() { benign_error=1 "$@" || { export_e; true; }; } |
241 | 241 |
alias try='prep_try; "try" ' # last space alias-expands next word |
242 | 242 |
|
243 |
catch() { test "$e" -eq "$1" && e=0; }
|
|
243 |
catch() { test "$e" = "${1:-0}" && e=0; } # also works w/ $1=''
|
|
244 | 244 |
|
245 |
ignore_e() { catch "$@" || true; } |
|
245 |
ignore_e() { catch "$@" || true; } # also works w/ $1=''
|
|
246 | 246 |
|
247 | 247 |
alias end_try='rethrow' |
248 | 248 |
alias end_try_subshell='rethrow_subshell' |
Also available in: Unified diff
bugfix: catch(): also need to support $1='' because this is a now a use case of ignore_e()