Is it possible to detect *which* trap signal in bash? [duplicate]

You can implement your own trap function that automatically passes the signal to the function:

trap_with_arg() {
    func="$1" ; shift
    for sig ; do
        trap "$func $sig" "$sig"
    done
}

$ trap_with_arg func_trap INT TERM EXIT

The first argument to func_trap will be the name of the signal.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)