summaryrefslogtreecommitdiff
path: root/bashrc
diff options
context:
space:
mode:
authorReiner Herrmann <reiner@reiner-h.de>2023-11-19 13:23:51 +0100
committerReiner Herrmann <reiner@reiner-h.de>2023-11-19 13:23:51 +0100
commit3b0fcfa346f8114f9c82700cdac47d30d2964bc8 (patch)
tree7ae6a20dce1d075e5d2207363c5f6b5a9a828726 /bashrc
parent96c032f92783af8cbffd14014d4fe63f79199b03 (diff)
bashrc: include exit status in prompt
Diffstat (limited to 'bashrc')
-rw-r--r--bashrc6
1 files changed, 6 insertions, 0 deletions
diff --git a/bashrc b/bashrc
index 916ad2b..5c58c9e 100644
--- a/bashrc
+++ b/bashrc
@@ -49,6 +49,7 @@ esac
# prompt
__prompt_command() {
+ local exit_code=$?
PS1='${TITLE}'
local reset='\[\033[0m\]'
@@ -81,6 +82,11 @@ __prompt_command() {
PS1+=" [\j]"
fi
+ # exit code
+ if [ $exit_code -gt 0 ]; then
+ PS1+=" <$red_b$exit_code$reset>"
+ fi
+
PS1+=" $red\$$reset > "
}
PROMPT_COMMAND=__prompt_command