Improve readability of posix exit codes in prompt

This commit is contained in:
Kenneth Benzie 2019-03-13 11:12:37 +00:00
parent b842fb6437
commit 036f0255f8

View File

@ -72,6 +72,40 @@ fresh_line_one() {
# If the last command failed, display its error code at the right
if [[ $exit_code -ne 0 ]]; then
case $exit_code in
129) exit_code="SIGHUP" ;; # 128 + 1
130) exit_code="SIGINT" ;; # 128 + 2
131) exit_code="SIGQUIT" ;; # 128 + 3
132) exit_code="SIGILL" ;; # 128 + 4
133) exit_code="SIGTRAP" ;; # 128 + 5
134) exit_code="SIGABRT" ;; # 128 + 6
134) exit_code="SIGIOT" ;; # 128 + 6
135) exit_code="SIGBUS" ;; # 128 + 7
136) exit_code="SIGFPE" ;; # 128 + 8
137) exit_code="SIGKILL" ;; # 128 + 9
138) exit_code="SIGUSR1" ;; # 128 + 10
139) exit_code="SIGSEGV" ;; # 128 + 11
140) exit_code="SIGUSR2" ;; # 128 + 12
141) exit_code="SIGPIPE" ;; # 128 + 13
142) exit_code="SIGALRM" ;; # 128 + 14
143) exit_code="SIGTERM" ;; # 128 + 15
144) exit_code="SIGSTKFLT" ;; # 128 + 16
145) exit_code="SIGCHLD" ;; # 128 + 17
146) exit_code="SIGCONT" ;; # 128 + 18
147) exit_code="SIGSTOP" ;; # 128 + 19
148) exit_code="SIGTSTP" ;; # 128 + 20
149) exit_code="SIGTTIN" ;; # 128 + 21
150) exit_code="SIGTTOU" ;; # 128 + 22
151) exit_code="SIGURG" ;; # 128 + 23
152) exit_code="SIGXCPU" ;; # 128 + 24
153) exit_code="SIGXFSZ" ;; # 128 + 25
154) exit_code="SIGVTALRM" ;; # 128 + 26
155) exit_code="SIGPROF" ;; # 128 + 27
156) exit_code="SIGWINCH" ;; # 128 + 28
157) exit_code="SIGIO" ;; # 128 + 29
158) exit_code="SIGPWR" ;; # 128 + 30
159) exit_code="SIGSYS" ;; # 128 + 31
esac
local result=" %{%B%F{1}%}$exit_code%{%f%b%}"
fi