aboutsummaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2010-06-07 07:19:54 -0500
committerVictor Lowther <victor.lowther@gmail.com>2010-07-11 19:01:27 -0500
commit4300436822ac740888bce3d3dbbfe845e32b9305 (patch)
treef70a978f62a49136aabd15a5841e33b56a6823dc /functions
parent597a4d96665b63705124bb9be5c71534f4b5bf0f (diff)
downloadinitscripts-4300436822ac740888bce3d3dbbfe845e32b9305.tar.xz
Clean up status() function.
Calling your args with $* will do nasty things if any of your args has a space in it. "$@" will always do The Right Thing. Just test the command directly, don't run it and then grab its exit value.
Diffstat (limited to 'functions')
-rw-r--r--functions8
1 files changed, 3 insertions, 5 deletions
diff --git a/functions b/functions
index b0a5912..126546a 100644
--- a/functions
+++ b/functions
@@ -123,14 +123,12 @@ stat_die() {
status() {
stat_busy "$1"
shift
- $* >/dev/null 2>&1
- if [ $? -eq 0 ]; then
+ if "$@" >/dev/null 2>&1; then
stat_done
return 0
- else
- stat_fail
- return 1
fi
+ stat_fail
+ return 1
}
# usage : in_array( $needle, $haystack )