I have a bash script which I need to convert from linux to FreeBSD, but I'm obviously too stupid to read the man page in a proper way.The script has a line along:date +%d -r $filewhich works fine under linux, but just givesdate: illegal time formaton FreeBSD.The linux man page says that -r is used to specify the referencre file:   -r, --reference=FILE          display the last modification time of FILEWhat puzzles me here, is that the FreeBSD man page contains the same usage for this switch, but also provides an alternate one: -r seconds     Print the date and time represented by seconds, where seconds is     the number of seconds since the Epoch (00:00:00 UTC, January 1,     1970; see time(3)), and can be specified in decimal, octal, or     hex. -r filename     Print the date and time of the last modification of filename.Obviously the above error messages results from the expectation of a UNIX timestamp as parameter for the -r switch instead of the provided filename.What I don't understand, is how I am supposed to make it clear that I want to use the second interpretation of the -r switch. If it is supposed to be deduced from the context of the call, I'm confused on how to provide this context.Can anybody please explain to me, how I am supposed to tell the date utility, which use case of the -r switch I want to use here?
FreeBSD date utility -r switch confuses me
freebsd;date;date utility
Looks like this -r usage only made it into the sources on 7 May 2015. Perhaps your version doesn't do this yet?Revision 282608 - (view) (download) (annotate) - [select for diffs] Modified Thu May 7 20:54:38 2015 UTC (12 months, 1 week ago) by delphij date(1): Make -r behave like GNU's version when the option can not beinterpreted as a number, which checks the file's modification time anduse that as the date/time value.