Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting a prompt with current path name on Korn Shell

Status
Not open for further replies.

shine67

Programmer
Jan 11, 2002
41
US
What is the equivalent setting on ksh with the following csh alias.

alias cd 'cd \!* ; getprompt'
alias getprompt 'set prompt="${HOST}:$cwd/ \! % "'

This is basically to display the current directory on the prompt. For instance if I am at /var/mail then I want the prompt to look like

HostName:/var/mail 335 %

where 335 is the command number on the history list.

W/o this I have to constantly type 'pwd' to see where I am.

Thanks,
Shine.
 
Something like this ?
Code:
export PS1="`hostname`:"'$PWD'" > "

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Great! Thanks for quick reply. It works.

Now a question. How are "" and '' mixed there working? What does '$PWD' do?

Thanks again,
Shine
 
man ksh
Pay attention to Quoting and to parameters automatically set by the shell

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top