termclock.sh - draws an analog clock from letters
When I started to learn Linux I met two commands : xclock
and bc
. And I got the idea to imitate the first using the second.
You will see nothing from the original bc
based implementations. I am not really proud of those.
The current version uses an “angle” table from which derives the needed sine & cosine values then precalculates the positions. This makes it faster and uses less
resources. And of course, reduces the dependencies to tput
only.
termclock.sh just indicates the time and indicates the time and… You have to press Ctrl-C to stop it.
12 11 1 10 2 9 m m o h 3 m m s h m m m s h h s h s 8 s 4 s s s 7 5 6
If you resize the terminal window in which runs, the clock gets resized.
Configuration
None.
Not even command line parameters exist.
Versions
- 1.0 - January 2004
- Initial release, just a proof of concept.
- 1.1
- Transformed into usable script.
- 1.2 - August 2008
- Optimized for speed by reducing the calls for
bc
.
- Optimized for speed by reducing the calls for
- 1.3 - September 2008
- Rewritten to use precalculated sin/cos table.
Plans
- Make the hands to look less dashed.
- I could borrow some options from
xclock
to set the look and feel.
Download
You can find the related files on GitHub in my bash-script repository’s termclock directory :
- termclock.sh - script
- termclock.sh.1 - man page
- termclock.sh.pod - man page source