title: Bash Output different from command line
body: <p>I have tried all kinds of filters using grep to try and solve this but just cannot crack it.</p>
  
  <pre><code>cpumem="$(ps aux | grep -v 'grep' | grep 'firefox-bin' | awk '{printf $3 "\t" $4}'
  </code></pre>
  
  <p>I am extracting the CPU and Memory usage for a process and when I run it from the command line, I get the 2 fields outputted correctly:</p>
  
  <pre><code>ps aux | grep -v 'grep' | grep 'firefox-bin' | awk '{printf $3 "\t" $4}'
  &gt; 1.1 4.4
  </code></pre>
  
  <p>but the same command executed from within the bash script produces this:</p>
  
  <pre><code>cpumem="$(ps aux | grep -v 'grep' | grep 'firefox-bin' | awk '{printf $3 "\t" $4}')"
  echo -e cpumem
  &gt; 1.1 4.40.0 0.10.0 0.0
  </code></pre>
  
  <p>I am guessing that it is picking up 3 records, but I just don't know where from.</p>
  
  <p>I am filtering out any other grep processes by using grep -v 'grep', can someone offer any suggestions or a more reliable way ??</p>