在对数组的赋值时间出现错误


qii=(`cat card.txt`)
#aii=(`cat ip.txt`)
lli=(`wc -l card.txt`)
        aa=( )
for((yyi=0;yyi<$lli;yyi++))
do
#       aa=()
    aai=`ifconfig ${qii[$yyi]}|grep -w 'inet'`
    if [ !  -n "$aai" ]

    then
     let     ${aa[$yyi]}= "1 "
     else
           let   ${aa[$yyi]} == "$aai"

fi
done
~         

给数组aa 赋值

./9.sh: line 14: let: ==: syntax error: operand expected (error token is "==")
./9.sh: line 14: let: ==: syntax error: operand expected (error token is "==")
./9.sh: line 14: let: ==: syntax error: operand expected (error token is "==")


报错了


let ${aa[$yyi]} == "$aai"
的双等于号,改为单等于号即可:
let ${aa[$yyi]} = "$aai"