10 Jul
2011
10 Jul
'11
6:56 p.m.
The exit code returned by the given command might be useful/expected, so don't discard but return it. --- functions | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/functions b/functions index 202db30..6efcd52 100644 --- a/functions +++ b/functions @@ -156,12 +156,10 @@ stat_die() { status() { stat_busy "$1" shift - if "$@" &>/dev/null; then - stat_done - return 0 - fi - stat_fail - return 1 + "$@" &>/dev/null + local ret=$? + (( $ret == 0 )) && stat_done || stat_fail + return $ret } # usage : in_array( $needle, $haystack ) -- 1.7.1