I am trying to run bash code that errors when doing what I think is subtracting minutes from a date. There is an error that has to do with mutual exclusion that I can't find info about.
The code runs this command:
datestr=$(date -d -3 minutes -r IOP4/DSC_0041.JPG "+%Y%m%d_%H%M")
When I run just date -r IOP4/DSC_0041.JPG "+%Y%m%d_%H%M" I get the value: 20220217_2223
It seems thus that the issue I'm having is with the -d -3 minutes portion. Based on what I've read online I thought maybe the command would work if it was instead written:
datestr=$(date -d "-3 minutes" -r IOP4/DSC_0041.JPG "+%Y%m%d_%H%M") or
datestr=$(date -d "-3 min" -r IOP4/DSC_0041.JPG "+%Y%m%d_%H%M") or
datestr=$(date -d "now -3 minutes" -r IOP4/DSC_0041.JPG "+%Y%m%d_%H%M"),
None of these work either; no matter what I get the error:
date: the options to specify dates for printing are mutually exclusive Try 'date --help' for more information.