linux shell scripts:Syntax error: Bad for loop variable
时间:2014-11-18 15:59:58
收藏:0
阅读:249
运行脚本报错
#!/bin/bash s=0 for (( i=1; i<=100; i++ )) do s=$(( $s + $i )) done echo $s
sh add.sh 报错:
add.sh: 4: Syntax error: Bad for loop variable
代码没有错误,Ubuntu为了加快开机速度,用dash代替bash。
解决办法:取消dash,使用bash:
sudo dpkg-reconfigure dash
选择No选项。原文:http://blog.csdn.net/love254443233/article/details/41247337
评论(0)