您现在的位置是:网站首页> 编程资料编程资料

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

2023-05-26 348人已围观

简介 Shell脚本之无限循环的两种方法_linux shell_

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

-六神源码网