[Lvlug] I was bored..

Linc Fessenden linc@thelinuxlink.net
Thu, 13 Jun 2002 10:20:37 -0400 (EDT)


I got bored this morning for 5 minutes and decided to look around the web
and happened to glance around at thinkgeek..  Anyway they have a pretty
cool binary wristwatch and I thought that was a neat thing anfd maybe I
should write a little "binary clock" script.  Well 5 minutes later I had
it and it works fine with one exception...  I can't figure out how to get
bc to constantly output 6 digits right justified.
Here is your mission should you choose to accept it.  Run this little
script and see if you can figure out how to right justify the output to 6
chars (0 filled)...

Here it is!

#!/usr/bin/bash
clear
while : ;
	do 
		hr=`date +%H`;
		mi=`date +%M`;
		se=`date +%S`;
		tput cup 0 0; echo "obase=2; $hr" | bc;
		tput cup 1 0; echo "obase=2; $mi" | bc;
		tput cup 2 0; echo "obase=2; $se" | bc;
	done


-- 
-Linc Fessenden

In the Beginning there was nothing, which exploded - Yeah right...