title: stop shell script in background by sending signal
body: <p>I have a bash shell script <code>S1</code> that starts another shell script <code>S2</code> (contains just <code>sleep 20</code>) synchronously, i.e. in the foreground.</p>
  
  <p>What I want is the following:</p>
  
  <p>When I send SIGTERM or SIGINT to <code>S1</code>, both <code>S1</code> and <code>S2</code> should stop.</p>
  
  <p>Actually that works if I start <code>S1</code> on the command line in the foreground an if I press CTRL-C (independent of whether I trap SIGINT in the scripts explicitly or not).</p>
  
  <p>When I start <code>S1</code> in the background and then send it the SIGINT signal with <code>kill -s SIGINT $!</code> it takes until <code>S2</code> terminates its normal processing, i.e. <code>S2</code> is not interrupted.</p>
  
  <p>My use case is the latter and I a need a way to interrupt both <code>S1</code> and <code>S2</code> by sending a signal just to <code>S1</code>.</p>