3
$ cal -h
Usage: cal [general options] [-jy] [[month] year]
       cal [general options] [-j] [-m month] [year]
       ncal -C [general options] [-jy] [[month] year]
       ncal -C [general options] [-j] [-m month] [year]
       ncal [general options] [-bhJjpwySM] [-H yyyy-mm-dd] [-s country_code] [[month] year]
       ncal [general options] [-bhJeoSM] [year]

General options: [-31] [-A months] [-B months] [-d yyyy-mm]

I was hoping to turn off the highlighting of the day.

3
  • -h is for --help
    – Kulfy
    Aug 8, 2019 at 21:08
  • you are right. It is a little odd. If you do " man cal" it describes -h option as turning off the highlighting.. Yet in practice it provides usage help. Anyway I will use ncal in future.
    – user587469
    Aug 9, 2019 at 7:42
  • except ncal produces a calendar with the days of the week down the side instead of across the top Nov 2, 2020 at 15:28

1 Answer 1

3

No, it's not a bug. If you have a look at the /usr/bin/cal file, you'll see that it's a symlink:

$ ls -l /usr/bin/cal
lrwxrwxrwx 1 root root 4 Jan 17  2018 /usr/bin/cal -> ncal

cal points to ncal. The binary modifies it's behavior based on which name it is called under. The hint is that the two first lines of cal -h lists cal, whilst the next lines lists ncal.

ncal -h disables hi-lighting of the current day.

The reason it's implemented this way is to provide a better cal without breaking the old format. This is also noted in man cal:

History

A cal command appeared in Version 5 AT&T UNIX. The ncal command appeared in FreeBSD 2.2.6. The output of the cal command is supposed to be bit for bit compatible to the original Unix cal command, because its output is processed by other programs like CGI scripts, that should not be broken. Therefore it will always output 8 lines, even if only 7 contain data. This extra blank line also appears with the original cal command, at least on Solaris 8

1
  • 1
    Thanks for that vidarlo. So ncal -h -b does exactly what I want.
    – user587469
    Aug 9, 2019 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy