tinyapps.org / blog


Printing multiple years with Unix cal command #

The cal (calendar) command apparently does not include an argument for displaying multiple years. Happily, bash supports numeric ranges / step values / brace expansions as of version 3, so one possible solution is:
$ for y in {2000..2009}; do cal $y; done

/nix | Jul 09, 2009


Subscribe or visit the archives