Fix exit code of last command in bash prompt

This commit is contained in:
Fernando Schauenburg 2019-10-31 03:15:14 +01:00
parent ea58023c79
commit 3b3e080335

View file

@ -116,7 +116,8 @@ PS1="\$ "
PROMPT_COMMAND=__ps1_set
__ps1_set() {
if [ $? -ne 0 ]; then
local exit_code=$?
if [ $exit_code -ne 0 ]; then
local status="$PS1_STATUS$exit_code$PS1_RESET "
else
local status=""