<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/1999/html" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Ross Burton</title><link>http://www.burtonini.com/blog</link><description>A potted account of Ross' life</description><language>en</language><ttl>60</ttl><dc:creator>Ross Burton</dc:creator><admin:generatorAgent rdf:resource="http://pyblosxom.sourceforge.net/"/><admin:errorReportsTo rdf:resource="mailto:ross@burtonini.com"/><item><title>Shell Magic</title><guid isPermaLink="false">computers/shell-magic-2007-11-19-15-22</guid><link>http://www.burtonini.com/blog/computers/shell-magic-2007-11-19-15-22</link><description>This is a nice little bit of shell magic I discovered today: trap true TERM kill -- -$$ The first ...</description><content:encoded><![CDATA[    <p>
      This is a nice little bit of shell magic I discovered today:
    </p>
    <pre>trap true TERM
kill -- -$$</pre>
    <p>
      The first line means that when the shell receives a <tt>TERM</tt> signal,
      it executes <tt>true</tt>.  The normal behaviour would be to kill the
      process, so this means that the shell is immune to people sending a
      <tt>TERM</tt> signal to it.  The second line sends a <tt>TERM</tt> signal
      to the process group (<tt>-</tt> is the modifier to indicate a the process
      group of the PID, not just the PID) of the current process (<tt>$$</tt>).
    </p>
    <p>
      The end result?  Everything spawned by this script which hasn't gone and
      re-parented itself is killed: the ultimate in cleanup.
    </p>
    <p>
      <small>NP: <cite>Dedications</cite>, Klimek</small>
    </p>
]]></content:encoded><category domain="http://www.burtonini.com">/computers</category><dc:date>2007-11-19T15:22:00Z</dc:date></item></channel></rss>