Solved

Ksh - Prompt shows path

Posted on 2004-10-14
4
1,904 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 500 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IBM flash storage 840 15 62
Using Grep to Find a file 8 91
Write an app 10 70
awk sed variable in file 3 36
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.:

785 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