.profile: Fix non-POSIX parameter substitution

This commit is contained in:
Salt 2018-11-27 22:02:39 -06:00
parent 373654c000
commit 5dff2dca30

View File

@ -25,6 +25,7 @@
# If it is not, open a bug report at gitlab.com/rehashedsalt/home and I'll take
# care of it
# SHELLCHECK
# Not finding these sources is none of my concern; they're out of scope
# shellcheck disable=1091
# shellcheck disable=1090
@ -180,7 +181,11 @@ _ps1() {
;;
esac
# Show the tilde instead of $HOME
cpwd="${PWD/#$HOME/\~}"
if [ "${PWD#$HOME}" != "$PWD" ]; then
cpwd="~${PWD#$HOME}"
else
cpwd="$PWD"
fi
# Alert us if the last command failed
fail=""
if ! [ "$exitcode" = "0" ]; then