1
I'm trying to write a quick script that figures out the date of the next Monday that isn't today. Although the date command accepts this expression, it appears to interpret it as equivalent to "this monday". That is, if today is Monday, it emits today's date, otherwise it emits next week's Monday.
Any ideas how to do this with the date command (or really any command available to bash) without resorting to doing the date arithmetic myself?
Update: This appears to be something strange with my environment, as several folks have shown the command working as expected on their systems. This is what I see:
$ date
Tue Jul 31 23:38:28 UTC 2012
$ date -d 'next tuesday'
Tue Jul 31 00:00:00 UTC 2012
$ date --version
date (GNU coreutils) 5.97
It would appear I have an ancient version of date, perhaps that's my issue...
Time to update that antique box. Anyway, I've expanded my answer based on your additional information. – Michael Hampton – 2012-08-01T00:18:03.567