From 5dff2dca306a4a26e5a5c37f87deb3a8996478f8 Mon Sep 17 00:00:00 2001 From: Salt Date: Tue, 27 Nov 2018 22:02:39 -0600 Subject: [PATCH] .profile: Fix non-POSIX parameter substitution --- .profile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.profile b/.profile index cb546631..1430417a 100755 --- a/.profile +++ b/.profile @@ -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