Skip to content

Instantly share code, notes, and snippets.

@jurre
Created December 31, 2013 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jurre/8196940 to your computer and use it in GitHub Desktop.
Save jurre/8196940 to your computer and use it in GitHub Desktop.
Happy 2014!
#!/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