Display week numbers on 'cal' calendars through 'ncal'

May 07, '08 07:30:02AM

Contributed by: Anonymous

According to man cal, there's also an ncal command with extra options, such as displaying week numbers via the -w flag. But no ncal is installed in OS X. A little experiment reveals, however, that it's one and the same program -- it apparently behaves differently when named differently.

If you create an ncal link to the cal utility, you get a fully functional ncal program; note the week numbers below the calendar:

$ mkdir -p $HOME/bin
$ ln `which cal` $HOME/bin/ncal
$ $HOME/bin/ncal -w
    May 2008
Mo     5 12 19 26
Tu     6 13 20 27
We     7 14 21 28
Th  1  8 15 22 29
Fr  2  9 16 23 30
Sa  3 10 17 24 31
Su  4 11 18 25
   18 19 20 21 22
[robg adds: This works as described; you can also now use ncal -e or ncal -o to see the date for Easter (Western and Orthodox, respectively), -J for the Julian calendar, and -p to see the "country codes and switching days from Julian to Gregorian calendar as they are assumed by ncal." I tried creating an alias instead of a link, but that didn't work...can anyone explain why they chose to make cal and ncal work like this? Why not just give all the options to cal?]

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080505235824392