# - trap ---------------------------------------------------------------------- trap_cleanup() { echo trap '' TERM kill -TERM -$$ trap '-' EXIT } trap_cleanup_exit() { trap_cleanup exit 0 } trap_cleanup_sig() { trap_cleanup exit 1 } trap_init() { trap trap_cleanup_exit EXIT #trap cleanup_sig HUP INT QUIT INT TERM HUP # this is not comprehensive! trap trap_cleanup_sig 1 4 5 6 7 8 9 10 11 12 13 14 15 16 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 # this is comprehensive, on my Linux } trap_init