title: Return code from shell script run from PuTTY to calling batch file?
body: <p>I would like to ask a question about how to apply PuTTY and control its return values. My setup is like this.</p>
  
  <p>There's a <code>xxxxx.bat</code> file which contains PuTTY call with a ssh connection in the likes of:</p>
  
  <pre><code>putty.ext ssh 10.10.10.10 -l xxxx -pw yyyy -t -m wintest.txt
  </code></pre>
  
  <p>The file <code>wintest.txt</code> contains:</p>
  
  <pre><code>echo "wintest.txt: Before execute..."
  
  /home/tede/n55115/PD/winlinux/RUN.lintest.bsh
  
  echo "wintest.txt: After execute..."
  echo $?
  </code></pre>
  
  <p>The file <code>lintest.bsh</code> contains various commands, what interests me is to be able to capture the return value of a specific command in the .bsh file, and call on that value from the bat file, to add it into an if loop with a warning, ie <code>if $?</code> (or <code>%ERRORLEVEL</code> - I don't know what would work) <code>then</code> BLABLA</p>
  
  <p>I've read a lot of posts about this, but frankly this is my first time doing anything with .bat files so its all slightly confusing.</p>