Work around a bash evaluation error

This commit is contained in:
Roy Marples 2007-07-21 22:35:34 +00:00
parent 6343b48893
commit 9211d8b3db

View File

@ -422,20 +422,21 @@ iwconfig_scan() {
# Strip any duplicates # Strip any duplicates
local i=0 k=1 a= b= local i=0 k=1 a= b=
while [ ${i} -lt ${APS} ] ; do while [ ${i} -lt ${APS} ] ; do
k=$((${i} + 1)) k=$((${i} + 1))
while [ ${k} -le ${APS} ] ; do while [ ${k} -le ${APS} ] ; do
eval a=\$MAC_${i} eval a=\$MAC_${i}
eval b=\$MAC_${k} eval b=\$MAC_${k}
if [ "${a}" = "${b}" ] ; then if [ "${a}" = "${b}" ] ; then
eval a=\$QUALITY_${i} eval a=\$QUALITY_${i}
eval b=\$QUALITY_${k} eval b=\$QUALITY_${k}
local u=${k} local u=${k}
[ -n "${a}" -a -n "${b}" -a "${a}" -lt "${b}" ] && u=${i} # We need to split this into two tests, otherwise bash errors
[ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i}
unset MAC_${u} SSID_${u} CHAN_${u} QUALITY_${u} ENC_${u} unset MAC_${u} SSID_${u} CHAN_${u} QUALITY_${u} ENC_${u}
fi fi
k=$((${k} + 1)) k=$((${k} + 1))
done done
i=$((${i} + 1)) i=$((${i} + 1))
done done
local i=0 e= m= black= s= local i=0 e= m= black= s=