ccal - Pretty print the output from the unix cal program
Stu 2008-10-30 Created this page.
I don't like desktop clutter, so when I want to know the time I open (or switch to) an xterm and type date. I also like the output of the cal program, but it doesn't show the time. Ccal higlights the current date (using ANSI colour codes) from the output of cal, adds a separator and the time and prints it.
Ccal means colourcal, not colorcal.
October 2008 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 -------------------- 21:39:31
#! /usr/bin/env tclsh puts \n[regsub -line "(^| )([string trimleft [clock format [clock seconds] -format %e]])( |\$)" [string trimright [exec cal] " \n"] "\\1\x1b\[36m\\2\x1b\[0m\\3"] puts [string repeat - 20]\n[string repeat " " 5][clock format [clock seconds] -format %T]\n
See also cal for a pure-Tcl solution (without highlighting and time)