I’m trying to count how many weekends there are in a given month, but I can’t figure it out how to count them correctly… I thought ncal + grep commands would do the job, but they don’t work or I use AND with grep incorrectly.
My try was:
ncal 10 2015 | grep 'Sa.*Su' | echo "Weekends count: "$((`wc -w`))
But this one doesnt work. Should I use date or something…?