首页 > 开发 > Linux Shell > 正文

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

2020-07-27 19:07:52
字体:
来源:转载
供稿:网友

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

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表