I'd like to be able to retrieve the number of the Monday of the current week using a bash script in Ubuntu Linux.
Example and info: This past Monday (Oct 30th) was the fifth Monday in October, and Wednesday was the first day and obviously first Wednesday of November. The script I'm trying to make would be verifying a backup procedure has the correct week media available. I have weeks 1-5 available in terms of media. The script would run and check to see what week number Monday is in the current week. This week it would check and discover Monday was the fifth Monday, meaning week 5 media should be present. Next week it would check and find that it is the first Monday, so week 1 media should be present.
The script would run daily(Mon-Fri) and reference only the week number of the Monday. Meaning Monday week 1, week 2, 3, 4, and in some months 5.
I have a date command with some arithmetic that gets me the week of the month number, however it will only do that based on the current day. It is this:
$((($(date +%-d)-1)/7+1))
Hopefully I explained that well enough without it being too confusing.
Any help would be appreciated. Thank you!