Operating System - Linux
1753797 Members
6741 Online
108799 Solutions
New Discussion

Re: How to get 5th Saturday?

 
SOLVED
Go to solution
Greg Vaidman
Respected Contributor

Re: How to get 5th Saturday?

seems like a lot of trouble - the following snippet will return the 5th saturday of the current month, or a blank if there is none:

cal | awk 'NR==7{print $7}'

you could run this on the first of each month and based on the output, generate the alert. for example:

sat5=$( cal | awk 'NR==7{print $7}' )
if [[ -n $sat5 ]]; then
: alert logic here
fi