首页 > 系统 > Linux > 正文

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

2019-10-26 18:45:30
字体:
来源:转载
供稿:网友

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

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