.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 # Set up a default PS1
# This *should* work for all terminals. I know it works on ksh # This *should* work for all terminals. I know it works on ksh
_ps1() { _ps1() {
exitcode="$?"
r="\e[0m" r="\e[0m"
fg_blue="\e[34m" fg_blue="\e[34m"
fg_red="\e[31m" fg_red="\e[31m"
@ -115,8 +116,7 @@ _ps1() {
cpwd="${PWD/#$HOME/\~}" cpwd="${PWD/#$HOME/\~}"
# Alert us if the last command failed # Alert us if the last command failed
fail="" fail=""
exitcode=$? if ! [ "$exitcode" = "0" ]; then
if ! [ "$exitcode" ]; then
fail="${fg_bold}${fg_red}?" fail="${fg_bold}${fg_red}?"
fi fi
printf "[${hostname_prefix}${cpwd}${r}]${fail}${r}${fg_green}\$${r} " printf "[${hostname_prefix}${cpwd}${r}]${fail}${r}${fg_green}\$${r} "