• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Date trouble
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Date trouble


  • Subject: Re: Date trouble
  • From: "Mark J. Reed" <email@hidden>
  • Date: Fri, 20 Oct 2006 10:46:10 -0400

Minor digression on shell syntax; feel free to skip.

Those of you paying attention but not familiar with shellscripting
might have noticed that some of us have suggested {  date +"%F %T"  }
and others { date "+%F %T"  } (note the different positions of the
opening quote).  Those are exactly the same as far as the shell is
concerned; the quotes control the interpretation of what's between
them (e.g. preventing spaces from being treated as delimiters) but
don't act as delimiters themselves.   So all of these, along with
various other permutations, are equivalent commands:

date "+%F %T"
date +"%F %T"
date +%F" "%T
date +%"F %"T

The only reason you need quotes at all is to prevent the space between
the F and the % from splitting the format string into two separate
arguments to the date command.  You could accomplish the same thing by
quoting just the space with a backslash:

date +%F\ %T

You can also replace the double quotes with single quotes without
changing anything in this case, which as I said is my preference for
use from AppleScript "do shell script" since it avoids the need to
quote the quote.

I mention this only because it's somewhat different from the way most
other languages handle quoted strings, and can be confusing, even to
veteran shellscripters.

We now return you to your regularly-scheduled AppleScript discussion,
already in progress.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Date trouble
      • From: ishmael <email@hidden>
References: 
 >Re: Date trouble (From: Marc Myers <email@hidden>)

  • Prev by Date: Why is it?
  • Next by Date: Re: Date trouble
  • Previous by thread: Re: Date trouble
  • Next by thread: Re: Date trouble
  • Index(es):
    • Date
    • Thread