mka*_*kab 18 linux bash shell for-loop dash-shell
我在实现for循环时遇到问题.我执行脚本时遇到此错误
test1.sh:2:语法错误:循环变量错误
我不明白这个错误.
这是我的剧本
#!/bin/bash
for (( c=1; c<=5; c++ ))
do
echo "Welcome $c times..."
done
Run Code Online (Sandbox Code Playgroud)
任何人都可以在ubuntu中告诉我for循环的语法(在ubuntu中它链接到破折号shell)shell吗?
标准POSIX shell仅接受语法 for varname in list
类似C的for循环语法for (( expr1; expr2; expr3 ))是一种基础.
您可以使用标准POSIX shell中获得类似的行为 for c in $(seq 1 5)
| 归档时间: |
|
| 查看次数: |
30979 次 |
| 最近记录: |