title: Having a single quote inside a single quoted string
body: <p>My question targets Zsh, but from what I tried, it seems to apply to POSIX shell and bash as well:</p>
  
  <p>I want to write a string containing literal <code>$</code> characters (no interpolation intended) and single quotes. Since the chapter on QUOTING in the Zsh man page says about single-quoted strings: </p>
  
  <blockquote>
    <p>A literal <code>'</code> character can be included in the string by using the \' escape.</p>
  </blockquote>
  
  <p>I tried something like this (in an interactive zsh, before doing it in a script):</p>
  
  <pre><code>echo 'a$b\'c'
  </code></pre>
  
  <p>I expected that this would print <code>a$b'c</code>, but zsh tells me that I have an unclosed quote.</p>
  
  <p>I am aware that I can use as a workaround</p>
  
  <pre><code>echo 'a$'"b'C"
  </code></pre>
  
  <p>but I still would like to know, why my original attempt failed.</p>