commit 3329c0320e55b7826beab8d83aff3386bb865c6e from: the xhr date: Sun May 29 20:41:30 2022 UTC Display the return code only if != 0. Color it red commit - 30c716a747523d4149a1f9609bf93728e0a8fcac commit + 3329c0320e55b7826beab8d83aff3386bb865c6e blob - 3fe6497e195cb8cd7b71a7425fd308e2e654898d blob + 5eae8f5c8ba76d6c222891947fe2922626390ea6 --- .kshrc +++ .kshrc @@ -448,8 +448,13 @@ set -A complete_got_1 -- $(got -h 2>&1 | sed -n s/comm ############################################################################# # PROMPT ############################################################################# - +_error_code() { + local _temp=$? + if [ $_temp -ne 0 ]; then + echo -n "\033[38;5;1m [$_temp]\033[m" + fi +} if [ -z "$SSH_CLIENT" ]; then PS1_TRENNER="!!" @@ -460,7 +465,7 @@ fi if [[ $(id -u) -eq 0 ]]; then PS1='\h$PS1_TRENNER\\033[0;101m\u\\033[0m \w [$?]\n\$ ' elif [[ $(whoami) = "xhr" ]]; then - PS1='\h \w$(_polyglot_branch_status) [$?]\n\033[38;5;11m\$\033[m ' + PS1='\h \w$(_polyglot_branch_status)$(_error_code) \033[38;5;11m\$\033[m ' else PS1='\h$PS1_TRENNER\u \w$(_polyglot_branch_status) [$?]\n\$ ' fi