I am using KornShell (ksh) on Solaris and currently my PS1 env var is:
PS1=\"${HOSTNAME}:\\${PWD} \\$ \"
And the prompt displays: hostname:/fu
hostname:/fu
ENV=~/.kshrc, and then in your .kshrc:
function _cd { \cd "$@" PS1=$( print -n "$LOGNAME@$HOSTNAME:" if [[ "${PWD#$HOME}" != "$PWD" ]]; then print -n "~${PWD#$HOME}" else print -n "$PWD" fi print "$ " ) } alias cd=_cd cd "$PWD"
Brad