Setting PS1 in ksh?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Matt Alexander
Date:  
Subject: Setting PS1 in ksh?
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.