【发布时间】:2013-09-25 16:03:05
【问题描述】:
for (( i=0; i<=5; i++ ))
do
echo "$i Echoed"
done
这是用 vi 编辑器在“bubble.sh”中写的,它给了我这个错误
bubble.sh:1:bubble.sh:语法错误:循环变量错误
我似乎不明白为什么会这样……请帮忙
【问题讨论】:
标签: shell syntax-error
for (( i=0; i<=5; i++ ))
do
echo "$i Echoed"
done
这是用 vi 编辑器在“bubble.sh”中写的,它给了我这个错误
bubble.sh:1:bubble.sh:语法错误:循环变量错误
我似乎不明白为什么会这样……请帮忙
【问题讨论】:
标签: shell syntax-error
for 循环的样式是bash 扩展,POSIX shell 不支持。如果您使用不是指向bash 的链接的sh 运行脚本,则会收到该错误。
【讨论】: