Index | Thread | Search

From:
obsd@mulh.net
Subject:
Re: cal: add option to highlight the current day
To:
tech@openbsd.org
Date:
Tue, 18 Aug 2026 17:10:08 -0400

Download raw body.

Thread
  • obsd@mulh.net:

    cal: add option to highlight the current day

Anyone who knows me knows I'm never finished tweaking scripts
and it was a slow day at the home office.

I wanted to merge single month and full year to eliminate duplication.

Also merge all date execs into one for efficiency, this made quoting more
complex to ensure all execs and substitutions occur in correct order.

cal -y | eval sed -r "\"$(date +'/%Y/,$ s/^/~/;/  %Y/,$ s/~(.{0,$((2%m%%3*22))})/\1~/;
	/%B/,/[^ ]{4}/s/(~.{0,18})(%e)\>/\1`tput so`\2`tput se`/;s/~//')\""

Still not winning any beauty contests, now maybe an honorable mention in rube goldberg.