使用shell脚本for循环实现一天倒计时

时间:2017-06-01 15:46:15   收藏:0   阅读:784
#!/bin/bash
# 此脚本用于实现一天倒计时
# 2017-06-01
# 房佳亮

clear
for ((h=23;h>0;h--))
do
        [ $h -gt 0 -a $h -lt 10 ] && h=0$h
	for ((m=59;m>0;m--))
	do
		[ $m -gt 0 -a $m -lt 10 ] && m=0$m
		for ((s=59;s>0;s--))
		do	
			[ $s -gt 0 -a $s -lt 10 ] && echo $h:$m:0$s || echo $h:$m:$s 
			sleep 1
			clear
		done
	done
done

  

原文:http://www.cnblogs.com/crushlinux/p/6929143.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!