title: KSH - Check return code on individual commands in find -maxdepth 0 $path -type f -mtime +$daysold -exec rm -fv {}\;
body: <p>I am trying to figure out how to check the return codes on the <code>find</code> command and the <code>rm -fv</code> command in the following statement:</p>
  
  <pre><code>find -maxdepth 0 $path -type f -mtime +$daysold -exec rm -fv {}\;
  </code></pre>
  
  <p>Basically, if an error occurs, I want to know if it occurred in the <code>find</code> or the <code>rm</code> command and forward that information to our developers via e-mail. How would I go about this? I understand if I look at <code>$?</code>, it will just look at the statement as a whole.</p>