1830136 Members
2947 Online
109999 Solutions
New Discussion

Changing C shell prompt

 
robert maxwell_1
New Member

Changing C shell prompt

How do i change my c shell prompt to show the current path instead of hostname?
3 REPLIES 3
Alan Riggs
Honored Contributor

Re: Changing C shell prompt

Don't use csh, but in bourne, posix and ksh you modify the PS1 parameter. The one I use is:

PS1="<"'$LOGNAME'"@$(uname -n)> "'$PWD
James R. Ferguson
Acclaimed Contributor

Re: Changing C shell prompt

James R. Ferguson
Acclaimed Contributor

Re: Changing C shell prompt

Robert:

I should be more explicit. Add either of the following to your $HOME/.cshrc or $HOME/.login file.

To show both the hostname and the current working directory:

alias cd 'cd \!*;set prompt="[`hostname`]$cwd :"'

To show only the current working directory:

alias cd 'cd \!*;set prompt="$cwd : "'

In either case, whenever you change directories your prompt will be updated to reflect this.

...JRF...