• 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: "Quoted form" puzzlement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Quoted form" puzzlement


  • Subject: Re: "Quoted form" puzzlement
  • From: "Mark J. Reed" <email@hidden>
  • Date: Wed, 10 Nov 2010 14:12:46 -0500

What Yvan said.

In the shell, the way to get a literal string with no interpolation
whatsoever is to use single quotes.

'....'

Nothing is done to the stuff between single quotes.  No variable
expansion, no backslash processing, nothing.  Absolutely, 100% literal
data.

The problem is, that means there's no way to put a single quote inside
a single-quoted string.

But the thing about the shell that helps here is that you can put
different strings right next to each other and they're treated as one
big string instead of separate tokens.

So "foo"'bar'baz  is exactly the same as "foobarbaz" or 'foobarbaz'
or, since there are no funky characters, the unquoted word foobarbaz.

Applescript's "quoted form of" takes advantage of this feature to get
literal apostrophes into a string.  The string "Don't" becomes the
sequence 'Don'\''t':  the single-quoted string 'Don', followed by the
unquoted string \' which turns into a literal apostrophe, followed by
the single-quoted string 't'.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Fwd: "Quoted form" puzzlement (From: KOENIG Yvan <email@hidden>)

  • Prev by Date: Fwd: "Quoted form" puzzlement
  • Next by Date: Re: "Quoted form" puzzlement
  • Previous by thread: Fwd: "Quoted form" puzzlement
  • Next by thread: Re: "Quoted form" puzzlement
  • Index(es):
    • Date
    • Thread