?
Solved

Ksh - Prompt shows path

Posted on 2004-10-14
4
Medium Priority
?
1,940 Views
Last Modified: 2012-06-21
How do you set the prompt to show current directory in ksh?  It's easy in cshell.

alias cd 'cd \!*; set prompt="['hostname']<$cwd> ";
0
Comment
Question by:lcor
  • 3
4 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 12312184
Even easier in ksh.

export PS1='$PWD$ '

0
 
LVL 48

Accepted Solution

by:
Tintin earned 2000 total points
ID: 12312194
If you want exactly the same format as the csh version, do

export PS1='[$HOSTNAME]<$PWD> '
0
 
LVL 38

Expert Comment

by:yuzh
ID: 12314289
You can put the followings in your .profile:

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

0
 
LVL 48

Expert Comment

by:Tintin
ID: 12315581
yuhz.

No need to set PWD.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month17 days, 13 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question