test.sh:

#!/bin/sh 

while [ 1 ]
do
    date # 当前时间
    sleep 1s # 阻塞进程,延时1秒
done

输出:

[root@localhost shell]# ./test.sh        
Wed Apr  6 05:21:16 CST 2016
Wed Apr  6 05:21:17 CST 2016
Wed Apr  6 05:21:18 CST 2016
^C
[root@localhost shell]#


你可能感兴趣的文章