title: Ruby: How to insert three backslashes into a string?
body: <p>I want to use backticks in ruby for a programm call.
  The parameter is a String variable containing one or more backticks, i.e.
  "&amp;E?@@A`?". The following command yields a new label as its return value:</p>
  
  <pre><code>echo "&amp;E?@@A\`?" | nauty-labelg 2&gt;/dev/null
  </code></pre>
  
  <p>From a ruby program I can call it as follows and get the correct result:</p>
  
  <pre><code>new_label = `echo "&amp;E?@@A\\\`?" | nauty-labelg 2&gt;/dev/null`
  </code></pre>
  
  <p>I want to achieve the same using a variable for the label.
  So I have to insert three slashes into my variable label = "&amp;E?@@A`?" in order to escape the backtick. The following seems to work, though it is not very elegant:</p>
  
  <pre><code>escaped_label = label.gsub(/`/, '\\\`').gsub(/`/, '\\\`').gsub(/`/, '\\\`')
  </code></pre>
  
  <p>But the new variable cannot be used in the program call:</p>
  
  <pre><code>new_label = `echo "#{escaped_label}" | nauty-labelg 2&gt;/dev/null`
  </code></pre>
  
  <p>In this case I do not get an answer from nauty-labelg.</p>