title: ssh command output to save in a text file in shell script
body: <p>I want to write shell script, in which i am using ssh command.
  Whatever output i will get through ssh command i want save this in text file or varibale, so i can use this in my shell script.
  Currently i am saving output in a variable , but when i used that variable outside ssh command , value is showing blank.
  Code is</p>
  
  <pre><code>ssh hostname -c "'
  `pwd`;
  var=$(ps -ef | grep Consumer | cut -f6 -d' ')
  '";
  echo $?;
  
  echo "vbar  $var";
  </code></pre>
  
  <p>var value is blank when i print.</p>