I wanted to put a calendar in a file so I ran:
$ ncal -CMh > file.txt
But instead I received the following:
Usage: cal [general options] [-hjy] [[month] year] cal [general options] [-hj] [-m month] [year] ncal [general options] [-bhJjpwySM] [-s country_code] [[month] year] ncal [general options] [-bhJeoSM] [year] General options: [-NC31] [-A months] [-B months] For debug the highlighting: [-H yyyy-mm-dd] [-d yyyy-mm]
I was surprised because I was sure the command is correct. I thought perhaps,
getopts options are not permutable like I thought so I tried reordering the options. However all permutations that didn't have
$ ncal -hC $ ncal -Ch $ ncal -hM $ ncal -Mh $ ncal -MCh $ ncal -MhC $ ncal -hMC $ ...
My theory is that when
ncal enters cal mode using
-C it loses the
-M option probably because
-M didn't exist in original
cal. I have no idea if this is correct or not.
Why does this happen?
This is on latest Debian Jessie.