1 # Contributed by Noah Friedman and Roland McGrath.
3 # To be run by the PROMPT_COMMAND variable, so that one can see what
4 # the exit status of processes are.
6 function check_exit_status ()
11 if [ ${status} -ne 0 ] && [ ${status} != 128 ]; then
12 # If process exited by a signal, determine name of signal.
13 if [ ${status} -gt 128 ]; then
14 signal="$(builtin kill -l $((${status} - 128)) 2>/dev/null)"
15 if [ "$signal" ]; then signal="($signal)"; fi
17 echo "[Exit ${status} ${signal}]" 1>&2
22 PROMPT_COMMAND=check_exit_status