title: Difference between single and double quotes in awk
body: <p>I have this <code>awk</code> statement:</p>
  
  <pre><code>glb_library="my_library"
  awk "
          /^Direct Dependers of/ { next }
          /^---/                 { next }
          /^$glb_library:/       { ver=\$0; next }
                                 { gsub(/[[:space:]]/, '', \$0); print ver':'\$0 }
        " file
  </code></pre>
  
  <p>Basically, I have enclosed the <code>awk</code> code in double quotes so that the shell variable <code>glb_library</code> is expanded.  I have made sure to escape the <code>$</code> character to prevent the shell from expanding <code>$0</code>. Followed the guidance from <a href="https://stackoverflow.com/questions/6697753/difference-between-single-and-double-quotes-in-bash">here</a>.</p>
  
  <p><code>awk</code> gives me this error:</p>
  
  <pre><code>awk: syntax error at source line 5
   context is
                                     { gsub(/[[:space:]]/, &gt;&gt;&gt;  ' &lt;&lt;&lt;
  </code></pre>
  
  <p>I want to understand:</p>
  
  <ul>
  <li>Is it legal to use single quotes inside <code>awk</code>? Why is <code>''</code> not a null string like <code>""</code> is?</li>
  <li>Does <code>awk</code> treat single and double quotes differently?</li>
  </ul>
  
  <p>My code worked after I escaped the single quotes with backslashes and used <code>\"\"</code> to represent the null string instead of <code>''</code>.</p>