Hi there. I didn't really know where to put this exactly, just sharing with the world, looking for improvements...
You may not have realised (though you probably have) that unix time 1234567890 (seconds since the epoch) is nearly upon us. This is a small script which counts down the seconds to this event.
Code:
#!/bin/bash
# unixparty - a countdown script
secs=$[1234567890-`date +%s`]
while [ $secs -gt 0 ]
do
clear
echo
echo " Seconds until UNIX time 1234567890"
echo
secs=$[1234567890-`date +%s`]
echo " seconds: $secs"
mins=$[$secs/60]
echo " minutes: $mins"
hrs=$[$mins/60]
echo " hours: $hrs"
days=$[$hrs/24]
echo " days: $days"
sleep 1
done
echo
echo
echo " HAPPY UNIX 1234567890 second!!!"
echo
echo
My question? Can anyone improve upon this since it has a number of shortfalls.
1) It scrolls using the clear command
2) The sleep mechanism isn't entirely reliable (appears to hang for ~2 secs).
I look forward to hearing your replies, though I'm sorry if you've read this and feel I've wasted your time! (It is perhaps a bit purile!)
Matt