使用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

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM