Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #get holidays with a BASH Shell Script and the calendar command
- #holidays that don't fall on a set date
- #list all holidays in a range (that month or more than one month
- #Then grep for the holiday and cut
- calendar -t 250301 -A90|grep "Easter Sunday"|head -n1|cut -d\* -f1
- calendar -t 250601 -A30|grep Father|grep Sunday|cut -d\* -f1
- calendar -t 220501 -A30|grep Mother|grep Sunday|cut -d\* -f1
- #format it differently
- date -d "$(calendar -t 220501 -A30|grep Mother|grep Sunday|cut -d\* -f1) 2022" +%F master
- 2022-05-08
- #If you don't have calendar on your system
- #you can use ncal for some holidays
- #example Father's day is the 3rd Sunday in June
- ncal -m june 2025|grep "^Su"|awk '{print $4}'
- #somthing like Easter might be a little more difficult
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement