linux shell 实现循环输出

由于工作关系,需要一直监测debug口是否保持在active状态。

从网上查询了下资料,可以通过此方式实现

新建立一个脚本文件,如heart.sh 

内容如下:

#!/bin/bash

i=2

index=0

while((i>1))

do

        echo "this is ${index} times runing!"

        ((index++))

        sleep 2s

done

保存 

修改为可运行状态。

可以通过./heart.sh 执行来完成。就一致输出了。

注:shell小白学shell编程初步。

猜你喜欢

转载自blog.csdn.net/mainmaster/article/details/118442647