我写了这个 shellscript 文件。但是我得到 error near unexpected token
done'`
#!/bin/bash
i=1
while [ $i -lt 12 ]; do
echo Hi
i=$[$i+1]
done
以前,do
之前没有;
。我阅读了 stackexchange 答案并在 while []
之后写了 ;
,但我仍然收到错误。我无法在网上找到该解决方案。有任何想法吗?
最佳答案
i=$[$i+1]
这是错误的。你的意思可能是 i=$((i+1))
关于linux - 循环运行 shell 脚本时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27138946/