title: How to escape the single quote character in an ssh / remote bash command?
body: <p>I'm building a small set of scripts for remotely starting, stopping and checking the status of a process. The <code>stop</code> of these scripts should look for a process and kill it. Therefore I do:</p>
  
  <pre><code>ssh deploy@hera 'kill -9 `ps -ef | grep MapReduceNode | grep -v "grep" | awk -F " " '{print $2}' | head -n 1`'
  </code></pre>
  
  <p>The problem here is that the awk tokenization step needs single quotes and these clash with the single quote utilized for executing the remote command via ssh. How can these single quotes be escaped?</p>