pfr Odd. The pattern match is only failing for $HOME
. Try this version:
cd() {
set -x # tron
command cd -- "$@"
# if [[ "${PWD}/" == "${HOME}/"* ]]
# if echo "${PWD}/" | grep -q -- "^${HOME}/"
if expr "${PWD}/" : "${HOME}/" >/dev/null
then PS1=$(printf '\033[35m%s\033[0m \033[1;37m$\033[0m ' "~${PWD#$HOME}")
else PS1=$(printf '\033[35m%s\033[0m \033[1;37m$\033[0m ' "$PWD")
fi
set +x # troff
}
cd
Post output of above and also of:
printf '%s\n' "$SHELL" "$0" "$-" "$(id)"
Email me a copy of your ksh
as well for good measure.