小编Dha*_*abu的帖子

Bash中的"[0:命令未找到"

我试图在while循环中获取数组,并且还需要更新数组中的值.

以下是我试过的代码.我收到这个错误[0: command not found

#!/bin/bash
i=0
while [$i -le "{#myarray[@]}" ]
do 
    echo "Welcome $i times"
    i= $(($i+1)))
done
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

syntax bash shell

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

bash ×1

shell ×1

syntax ×1