From 75547557a8a4e8085a3556de5df16abeaf43ba99 Mon Sep 17 00:00:00 2001 From: UltimateByte Date: Tue, 21 Feb 2017 00:29:17 +0100 Subject: [PATCH] fixing awk, probably not infinite loop --- lgsm/functions/core_getopt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh index 94024ff79..ad5ee730d 100644 --- a/lgsm/functions/core_getopt.sh +++ b/lgsm/functions/core_getopt.sh @@ -113,7 +113,7 @@ index="0" for ((index="0"; index <= ${#currentopt[@]}; index+3)); do cmdamount="$(echo "${currentopt[index]}"| awk -F ';' '{ print NF }')" for ((cmdindex=1; cmdindex <= ${cmdamount}; cmdindex++)); do - optcommands+=( "$(echo "${currentopt[index]}"| awk -F ';' '{ print $cmdindex }')" ) + optcommands+=( "$(echo "${currentopt[index]}"| awk -F ';' -v x=${cmdindex} '{ print $x }')" ) done done @@ -139,7 +139,7 @@ else for ((index="0"; index <= ${#currentopt[@]}; index+3)); do currcmdamount="$(echo "${currentopt[index]}"| awk -F ';' '{ print NF }')" for ((currcmdindex=1; cmdindex <= ${currcmdamount}; currcmdindex++)); do - if [ "$(echo "${currentopt[index]}"| awk -F ';' '{ print $cmdindex }')" == "${getopt}" ]; then + if [ "$(echo "${currentopt[index]}"| awk -F ';' -v x=${cmdindex} '{ print $x }')" == "${getopt}" ]; then # Run command ${currentopt[index+1]} break