最近刚开始学习linux shell语言 看的是鸟哥的私房菜,里面有讲到执行shell脚本有两种方法: 1. 设置执行属性: chmod 755 file 执行(如果已经在当前目录) : ./file 2. 使用: sh file 执行 .但是在vmware里装的ubuntu 11.10却无法执行 #!/bin/bashdeclare -i sfor (( i = 1; i <= 100;i = i+1 ))do s=s+idoneecho "The count is ==> $s" 使用第二种方法执行时出现 : test04_for.sh: 1: declare: not found test04_for.sh: 3: Syntax error: Bad for loop variable 百度了下网上,解决方法: 在终端中输入: sudo dpkg-reconfigure dash 然后出现的界面中选择 NO 然后就能正确运行了。 |