Hacker News new | ask | show | jobs
by myhf 4974 days ago
It's cool to also see the name of the signal that caused exit status > 128. Sadly this only fits in a tweet if it can assume the possible signal names are listed contiguously, which isn't so on 64-bit Linux these days.

  S=(`trap -l`);e(){ for N in ${PIPESTATUS[@]};do ((N>128))&&echo ${S[$((2*N-257))]}||echo $N;done;};trap $'echo "\e[41m Exit "`e`" \e[m"' ERR
1 comments

That's a great idea. I've rewritten my own version to use these signals instead of numbers where possible.