title: Non-bash equivalent to "trap ERR"
body: <p>I'm trying to remove some bashisms from a shell script.</p>
  
  <p>I can't figure out how I would replicate 'trap ERR': ERR is not a signal, and is not in the <a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_28" rel="nofollow">standard</a>, but is a common bashism (see e.g. <a href="http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_12_02.html" rel="nofollow">the LDP guide</a>).</p>
  
  <p>How do I replicate <code>trap ERR</code> in a standards-compliant <code>/bin/sh</code> script? </p>