Skip to content

Instantly share code, notes, and snippets.

@SamRothCA
Created November 28, 2014 17:05
Show Gist options
  • Select an option

  • Save SamRothCA/ae1541b61bf777a5918f to your computer and use it in GitHub Desktop.

Select an option

Save SamRothCA/ae1541b61bf777a5918f to your computer and use it in GitHub Desktop.
Calendar for current month
cal | grep --before-context 6 --after-context 6 --color -e " $(date +%e)" -e "^$(date +%e)"
@pi1ot

pi1ot commented Dec 20, 2014

Copy link
Copy Markdown

cal | grep --before-context 6 --after-context 6 --color -e " $(date +%e) " -e "^$(date +%e)" -e "$(date +%e)$"

@jorgeyp

jorgeyp commented Jan 19, 2015

Copy link
Copy Markdown

What is the difference @pi1ot ?

@5amfung

5amfung commented Apr 12, 2015

Copy link
Copy Markdown

@pi1ot I got segfault.

@sheroze1123

Copy link
Copy Markdown

This wouldn't work when the date number shows up in the year number. (e.g. 20th April, 2015) This works better. Also, change the shell to be /bin/bash if you're using an alternate shell.

cal | head -n 1; cal | tail -n +2 | grep --before-context 6 --after-context 6 --color -e " $(date +%e)" -e "^$(date +%e)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment