Shell脚本之无限循环的两种方法

来自:网络
时间:2022-03-19
阅读:

for 实现:
复制代码 代码如下:
#!/bin/bash
set i=0
set j=0
for((i=0;i<10;))
do
        let "j=j+1"
        echo "-------------j is $j -------------------"
done

while实现:
复制代码 代码如下:
#!/bin/bash
set j=2
while true
do
        let "j=j+1"
        echo "----------j is $j--------------"
done

返回顶部
顶部