Skip to content

Instantly share code, notes, and snippets.

@Crysknife007
Created March 24, 2013 19:37
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 Crysknife007/5233192 to your computer and use it in GitHub Desktop.
Save Crysknife007/5233192 to your computer and use it in GitHub Desktop.
Binary Bash Clock. Relies on bc.
#!/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