1

I'm trying to include a date flag "date -R" in a bash script to use RFC 2822 and the script works fine in macOS 10.12 but not in Mac OS X 10.11. I get an illegal option.

I checked the man pages for date and the date -R flag seems to be available in 10.12 but not in 10.11 even though both systems are running the same version of bash.

Any idea of why there would be a difference or any work arounds? We're testing -u to use a universal time code but my main concern is non-english unicode characters.

We're trying to to convert non-English Unicode characters in CSV files and timestamps keep showing up as issues.

  • `bash` != `date`. Additionally, `-R` is just a short cut for a particular format expression, which would be added like `+"%Y..."` – bishop Feb 08 '17 at 19:24
  • 1
    It appears `date -R` is equivalent to `date "+%a, %d %b %Y %H:%M:%S %z"` – glenn jackman Feb 08 '17 at 19:28
  • 1
    @glennjackman More precisely, `LC_ALL=C date "+%a, %d %b %Y %H:%M:%S %z"`. Otherwise on non-US systems the `%a` will print the locale based weekday abbrev. – clt60 Feb 08 '17 at 19:34
  • Thanks for the quick responses! As it turns out the date in El Capitan is from 2007 and Sierra's is from 2015. We're testing the -u but I will also test the format mentioned from glennjackman and @jm666. – BabyYodaDaddy Feb 08 '17 at 19:58
  • I have a link to Darwin man pages, but it's "legacy" (https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/). I could not find darwin man pages on apple's site. – glenn jackman Feb 08 '17 at 19:59
  • 1
    @AndrewMerrick, make sure you set LC_ALL as jm666 indicates. – glenn jackman Feb 08 '17 at 19:59
  • Will do! I edited my post after submitting because I forgot to include jm666. Thanks everyone! – BabyYodaDaddy Feb 08 '17 at 20:04

0 Answers0