title: Bash: execute content of variable including pipe
body: <pre><code>#!/bin/bash
  
  # 1st part
  ret=$(ps aux | grep -v grep)    # thats OK 
  echo $ret
  
  # 2nd part
  cmd="ps aux | grep -v grep"     # a problem with the pipe | 
  ret=$($cmd)         
  echo $ret
  </code></pre>
  
  <p>How can I use a command-string as I have in the 2nd part? Think the pipe is the problem. Tried to escape it but it did not help. Get some snytax error of ps.</p>
  
  <p>Thanks!</p>