title: Single Quote issue with gawk and shell script
body: <p>I am writing a small script to map all the current memory being used by services running in a server. However, I am facing a problem doing that. My script is quite simple. I'm using pmap to find out memory being used and trying add up all the pid of a service running.</p>
  
  <pre><code>#!/bin/bash
  result=`$pgrep java`
  wc=`$pmap -x $result | wc -l`
  gawk=`$pmap -x $result | gawk 'NR==$wc{print $3}'`
  
  echo "$gawk"
  </code></pre>
  
  <p>Now, my problem is that gawk uses <strong>single quote</strong> when searching for a specific pattern <strong>(gawk 'NR==$wc{print $3}')</strong> but shell script gives me error because then meaning of <strong>single quote</strong> is different in shell from gawk. </p>