Created
March 24, 2013 19:37
-
-
Save Crysknife007/5233192 to your computer and use it in GitHub Desktop.
Binary Bash Clock. Relies on bc.
This file contains 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 | |
# Binary Bash Clock | |
# Spike Snell - 2012 | |
while true; | |
do | |
clear | |
hour=$(date +%H) | |
minute=$(date +%M) | |
second=$(date +%S) | |
hour_binary=$(echo "ibase=10;obase=2;$hour" | bc) | |
minute_binary=$(echo "ibase=10;obase=2;$minute" | bc) | |
second_binary=$(echo "ibase=10;obase=2;$second" | bc) | |
printf "%06d\n" "$hour_binary" | |
printf "%06d\n" "$minute_binary" | |
printf "%06d" "$second_binary" | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment