Ksh - Prompt shows path

How do you set the prompt to show current directory in ksh?  It's easy in cshell.

alias cd 'cd \!*; set prompt="['hostname']<$cwd> ";
lcorAsked:
Who is Participating?
 
TintinConnect With a Mentor Commented:
If you want exactly the same format as the csh version, do

export PS1='[$HOSTNAME]<$PWD> '
0
 
TintinCommented:
Even easier in ksh.

export PS1='$PWD$ '

0
 
yuzhCommented:
You can put the followings in your .profile:

   HOSTNAME=$(hostname)
   PWD=$(pwd)
   PS1='${HOSTNAME}[${PWD}] !# '

0
 
TintinCommented:
yuhz.

No need to set PWD.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.