Solved

Ksh - Prompt shows path

Posted on 2004-10-14
4
1,898 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
Comment Utility
Even easier in ksh.

export PS1='$PWD$ '

0
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
Comment Utility
If you want exactly the same format as the csh version, do

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

Expert Comment

by:yuzh
Comment Utility
You can put the followings in your .profile:

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

0
 
LVL 48

Expert Comment

by:Tintin
Comment Utility
yuhz.

No need to set PWD.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
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…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now