.profile: Fix PS1 exit code

This commit is contained in:
Salt 2018-08-08 17:02:11 -05:00
parent 88d142990e
commit b7963bdd18

View File

@ -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} "