Setting PS1 in ksh?

Matt Alexander plug-discuss@lists.PLUG.phoenix.az.us
Sun, 15 Jul 2001 12:41:40 -0700 (PDT)


In bash, I'm able to set my prompt like so:

PS1="[\u@\h \w]\\$ "

I'd like to achieve the same results, but with ksh.  This gets me close:

PS1="[$LOGNAME@`hostname` \$PWD]$ "

But I'd like to have the ~ when I'm in my home directory.  I tried this next:


PS1="[$LOGNAME@`hostname` `if [ "$PWD" = "$HOME" ]; then echo '~'; else echo 
$PWD; fi`]$ "

But then it's always the ~ and doesn't update to the real current directory 
that I'm in as I move around.

Anyone have an idea how to accomplish this?
Thanks,
~Matt

--
Dance like it hurts.
Love like you need money.
Work when people are watching.