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

#!/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

  

posted @ 2017-06-01 15:34  房佳亮  阅读(3031)  评论(0编辑  收藏  举报