title: trouble running bash script remotely, redirecting output locally
body: <p>I am trying to run a script remotely (from a bash script), but am having trouble getting the output to redirect locally, for analysis. Running the script is no problem with:</p>
  
  <pre><code>ssh -n -l "$user" "$host" '/home/user/script.sh $params'
  </code></pre>
  
  <p>However I am unable to capture the output of that script. I have tried the following:</p>
  
  <pre><code>results=$(ssh -n -l "$user" "$host" '/home/user/script.sh $params')
  results=`ssh -n -l "$user" "$host" '/home/user/script.sh $params'`
  ssh -n -l "$user" "$host" '/home/user/script.sh $params' | grep "what I'm looking for"
  ssh -n -l "$user" "$host" '/home/user/script.sh $params' &gt; results_file
  </code></pre>
  
  <p>Any ideas?</p>