From 3b3e080335a91a8001defcac76c4e07f3bb995dc Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Thu, 31 Oct 2019 03:15:14 +0100 Subject: [PATCH] Fix exit code of last command in bash prompt --- dotfiles/.bashrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc index 9769906..f005c55 100644 --- a/dotfiles/.bashrc +++ b/dotfiles/.bashrc @@ -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=""