[PATCH 06/48] Clean up status() function.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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.
---
 functions |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/functions b/functions
index 0acdbbf..9d0aec3 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 )
-- 
1.7.1



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux