title: How to output return code in shell?
body: <p>I'm trying to call a custom shell script through <code>sh</code>:</p>
  
  <pre><code>/bin/sh -c 'myscript.sh` &gt;log.txt 2&gt;&amp;1 &amp; echo $!
  </code></pre>
  
  <p>Output of this command is a PID of a created background process. I want to instruct <code>/bin/sh</code> to save return code of <code>myscript.sh</code> to some file. Is it possible?</p>