1

I'm trying to use this command to do so:

defaults write test.plist LatestDate date "+%y-%m-%d"

where LatestDate is the key I'm modifying. The problem is, it doesn't recognize date "+%y-%m-%d" as what I'm trying to write to the key, and when I put it in quotes it simply writes that text, not the date to the key.

How should I go about doing this?

1

In defaults, date is just an option, not the actual date command. You need to actually pass the date.

defaults write test.plist LatestDate $(date +"%Y-%m-%d %l:%M:%S +0000")
  • I'm kind of confused as to what this is doing: the normal command gives me an unexpected argument error, and using -date $(date +"%Y") gives me 2016-10-03T10:00:00Z. I'm fine with the Date T Time Z format, but the actual time seems kind of strange... at 10 AM it gave that and I changed the system time to 11 AM, but it still gives that – Skeleton Bow Oct 3 '16 at 8:24
  • The edit I issued seemed to fix the problem – Skeleton Bow Oct 3 '16 at 8:46
  • 1
    @SkeletonBow Yep, oops sorry, cheers for the edit. – grg Oct 3 '16 at 8:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .