Skip to content

Comment on Halloween Bash Profile Generatorparent

Comments

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

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

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.