I'm trying to work on a script that will search for a certain variable in an array. Unfortunately the system I'm running changes the order of the array based on other variables at the time. I know the first seven characters of what I'm looking for will be RPT_NUM so I tried the following while loop, but I keep getting the error [: -ne: unary operator expected
START=5
MYVAR=( $(/usr/sbin/asterisk -rx "rpt showvars 47168"))
#VAR=${MYVAR[3]}
VAR="${MYVAR[START]}"
CURVAR= echo "${VAR:0:7}"
echo $VAR
while ["$CURVAR" -ne "RPT_NUM" ]
do
let START+=1
CURVAR= echo "${VAR:0:7}"
echo "End loop"
done
STATUS=echo "${VAR: -1}"
echo $STATUS
I'm fairly new and still learning so any help would be great.