cal Command Formatting

For years I have used a paper calendar in the office. I obtain the calendar from the local hardware store owners. At the back of the calendar is the full year of the next year’s calendar on a half-page.

That half-page calendar format is four months wide. A pair of scissors and thumb tacks provides a nice way to post the calendar to the cork board near the desk. The clipped calendar is convenient throughout the year.

One characteristic about humans is people change things simply because they can. This past year that nice half-page calendar format changed to two full pages. That size no longer fit the cork board without hogging lots of space.

Mildly irritating.

I looked at the cal command. Slackware uses the default util-linux version and does not use the ncal version. The default cal command outputs a full year calendar three months wide. Not the desired format for the cork board.

Some web surfing provided clues to obtain a four month wide format. After some tinkering I had a basic shell script.

    YEAR=${YEAR:-`date +%Y`}
    CAL_FILE="/tmp/$YEAR"

    echo "Using year $YEAR."
    echo > $CAL_FILE
    paste <(cal 1 $YEAR) <(cal 2 $YEAR) <(cal 3 $YEAR) <(cal 4 $YEAR) >> $CAL_FILE
    echo >> $CAL_FILE
    paste <(cal 5 $YEAR) <(cal 6 $YEAR) <(cal 7 $YEAR) <(cal 8 $YEAR) >> $CAL_FILE
    echo >> $CAL_FILE
    paste <(cal 9 $YEAR) <(cal 10 $YEAR) <(cal 11 $YEAR) <(cal 12 $YEAR) >> $CAL_FILE

    echo "The calendar is stored at $CAL_FILE."

Good enough.

Posted: Category: Usability Tagged: General

Next: MATE Loses Color Background Support

Previous: Obnoxious Web Sites