您好,我在启动时有脚本,但我不明白为什么它在执行时显示错误
#!/bin/sh
# Starting the network interface
PATH="/sbin:/bin:/usr/bin:/usr/sbin"
FILENAME="/etc/ipconf"
count=0
while read LINE
do
ipValues[count]=$(echo $LINE | awk -F'=' '{print $2}')
count=`expr $count + 1`
done < $FILENAME
echo "Setting up IP Address"
ifconfig eth0 up
ifconfig eth0 ${ipValues[0]} netmask ${ipValues[1]}
echo "IP :: ${ipValues[0]} SUBNET MASK :: ${ipValues[1]}"
route add default gw ${ipValues[2]}
echo "Default Gateway :: ${ipValues[2]}"
echo "Network configured properly"
exit 0
这是我的 ipconf 文件
IPADDRESS=192.168.1.13
SUBNETMASK=255.255.255.0
GATEWAY=192.168.1.220
这是我的脚本错误
ipValues[count]=192.168.1.13 Not found
ipValues[count]=255.255.255.0 Not found
ipValues[count]=192.168.1.220 Not found
Setting up IP Address
Line 20 syntax error: Bad substitution
我的剧本正在排队ifconfig eth0 ${ipValues[0]} netmask ${ipValues[1]}
。这个数组分配是正确的还是busybox脚本需要不同的方法?