title: How to trap exit 1 signal in Shell script?
body: <p>I would like to try trapping signal 1  but fail</p>
  
  <pre><code>#!/bin/bash
  # capture an interrupt # 0
  trap 'echo "Exit 0 signal detected..."' 0
  trap 'echo "Exit 1 signal detected..."' SIGHUP
  
  # display something
  echo "This is a checkpoint 1"
  exit 1
  
  echo "This is checkpoint 2"
  # exit shell script with 0 signal
  exit 0
  
  Output--
  kithokit@15:02:55 trunk (master) $ ./test.sh 
  This is a checkpoint 1
  Exit 0 signal detected...
  kithokit@15:03:44 trunk (master) $ 
  </code></pre>
  
  <p>Even if it is exit 1, it always trap into trap 0, any one knows how to solve this?</p>
  
  <p>Thanks</p>