Created
December 31, 2013 13:41
-
-
Save jurre/8196940 to your computer and use it in GitHub Desktop.
Happy 2014!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
formatted_time() { | |
local total_seconds=${1} | |
((hours=total_seconds/3600)) | |
((minutes=total_seconds%3600/60)) | |
((seconds=total_seconds%60)) | |
printf "%02d:%02d:%02d\n" $hours $minutes $seconds | |
} | |
clear | |
endsec=`date -j -f '%d %b %Y %T' "1 Jan 2014 00:00:00" +%s` | |
nowsec=`date +%s` | |
difsec=$((endsec-nowsec)) | |
while [ $difsec -gt 0 ] | |
do | |
tput cup 0 0 | |
echo -n "It's 2014 in: " | |
formatted_time "$difsec" | |
sleep 1 | |
nowsec=`date +%s` | |
difsec=$((endsec-nowsec)) | |
done | |
echo 'Happy 2014!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment