title: How can I escape shell arguments in AppleScript?
body: <p>Applescript does not seem to properly escape strings. What am I doing wrong?</p>
  
  <p>Example:</p>
  
  <pre><code>set abc to "funky-!@#'#\"chars"
  display dialog abc
  display dialog quoted form of abc
  </code></pre>
  
  <p>Expected / Desired Output:</p>
  
  <pre><code>funky-!@#'#"chars
  'funky-!@#\'#"chars'
  </code></pre>
  
  <p>Actual Output:</p>
  
  <pre><code>funky-!@#'#"chars
  'funky-!@#'\''#"chars'
  </code></pre>
  
  <p>As you can see, it appears that in the actual output Applescript is adding and escaping an extra <code>'</code></p>
  
  <p>I would be OK with the end characters being either <code>'</code> or <code>"</code> and I would also be fine with both the single and double quotes being escaped - but it appears that only the single quotes are actually escaped.</p>