I'm writing a bash script that should run on OSX and Ubuntu. I'm not sure if this particular problem is due to an OS mismatch; more likely it's a difference in the date command on the two shells, even though it's bash on both? Let's see.
On OSX's bash shell, in order to print a date from two days ago we're doing this:
date -v-2d +"%Y"."%m"."%d"
That -v flag is invalid on the Ubuntu bash shell however. Instead, there we're using:
date --date="2 days ago" +"%Y"."%m"."%d"
Unforuntately, the --date flag is unrecognized on our OSX bash shell.
I'd love for one command with flags that work in both instances, would anyone know what I could try?
bash. It's a problem with different implementations ofdate.