[GTALUG] pcal again

mwilson at Vex.Net mwilson at Vex.Net
Fri Aug 2 17:05:19 EDT 2024


Not actually pcal's fault.

Last time we sorted out how to get pcal to refer to the month after this
month.  But today the command line

pcal -l -m -Pletter $((`date  +%m` % 12 + 1)) $(date -d"next month" +%Y) |
ps2pdf  - $HOME/Desktop/nextmonth.pdf

threw out

/home/mwilson/bin/nextmonth: line 3: 08: value too great for base (error
token is "08")

`date +%m` returns '08' for August, which is an illegal octal number.

The fix for this is to force decimal casting, the way Ada does:

pcal -l -m -Pletter $((10#`date  +%m` % 12 + 1)) $(date -d"next month"
+%Y) | ps2pdf  - $HOME/Desktop/nextmonth.pdf

I guess `$(` takes special care of pound signs.  So I've learned something
again.



More information about the talk mailing list