运行脚本报错
#!/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
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!