View on GitHub

Ann Molly Paul

learn -- code -- inspire

Fun with Shell Scripting

February 15, 2014

For today, I wanted to include a calendar here to kinda mark when I started. I defaulted to use the simplest shell script that I thought of : $ CAL

Oops, CAPS lock was turned on. It gave me an interesting result with the days oriented vertically, not what I wanted though. Try 2 : $ cal

Hmm, I thought it would highlight "today". I was suprised to find out that cal in OSX doesn't highlight today by default. So, here's where I learnt a cool new script to make highlighting work!

$cal | grep -C3 --color " $(date +%-d)"

Oh, I created an alias for it as well.

$alias today='cal | grep -C3 --color " $(date +%-d)"'