From b7963bdd18164f788ad63871326f4a13eef73433 Mon Sep 17 00:00:00 2001 From: Salt Date: Wed, 8 Aug 2018 17:02:11 -0500 Subject: [PATCH] .profile: Fix PS1 exit code --- .profile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.profile b/.profile index 7eb8ac02..4fcdce12 100755 --- a/.profile +++ b/.profile @@ -99,6 +99,7 @@ fi # Set up a default PS1 # This *should* work for all terminals. I know it works on ksh _ps1() { + exitcode="$?" r="\e[0m" fg_blue="\e[34m" fg_red="\e[31m" @@ -115,8 +116,7 @@ _ps1() { cpwd="${PWD/#$HOME/\~}" # Alert us if the last command failed fail="" - exitcode=$? - if ! [ "$exitcode" ]; then + if ! [ "$exitcode" = "0" ]; then fail="${fg_bold}${fg_red}?" fi printf "[${hostname_prefix}${cpwd}${r}]${fail}${r}${fg_green}\$${r} "