git » libfiu » commit 3921b80

fiu-ctrl: Fix bash array appending

author Tommi Rantala
2009-07-03 12:31:47 UTC
committer Alberto Bertogli
2009-07-06 13:50:06 UTC
parent 06575e384e1a7c1087f85682d0f588b2830590e8

fiu-ctrl: Fix bash array appending

Properly append items to the bash variable CMDS. The += syntax gave
error message under Bash 2.x, and did not actually append items to the
array under Bash 3.x either.

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>

utils/fiu-ctrl +4 -3

diff --git a/utils/fiu-ctrl b/utils/fiu-ctrl
index 3683c23..a08e06d 100755
--- a/utils/fiu-ctrl
+++ b/utils/fiu-ctrl
@@ -67,9 +67,10 @@ function opts_reset() {
 function add_cmd() {
 	if [ "$NAME" != "" ]; then
 		if [ $PROB -ge 0 ]; then
-			CMDS+="enable_random $NAME $PROB $FAILNUM $FAILINFO"
+			C="enable_random $NAME $PROB $FAILNUM $FAILINFO"
+			CMDS[${#CMDS[*]}]="$C"
 		else
-			CMDS+="enable $NAME $FAILNUM $FAILINFO"
+			CMDS[${#CMDS[*]}]="enable $NAME $FAILNUM $FAILINFO"
 		fi
 		opts_reset;
 	fi
@@ -97,7 +98,7 @@ while getopts "+e:p:u:i:d:f:h" opt; do
 		FIFO_PREFIX="$OPTARG"
 		;;
 	d)
-		CMDS+="disable $OPTARG"
+		CMDS[${#CMDS[*]}]="disable $OPTARG"
 		opts_reset;
 		;;
 	h|*)