Greg Hinkel's UNIX Tip of the Week for March 24, 1996
Here's how to put your "current directory" in your prompt (for C Shell users).
I also put the current host name in my prompt.
set prompt="`hostname`:$cwd> "
This however, is not sufficient because if we "cd to another directory" the
prompt does not change. Somehow we need to change the prompt every time we
move to another directory. To do this we will create an alias for all the
"change directory" commands.
alias cd 'cd \!*; set prompt = "`hostname`:$cwd> "'
alias pushd 'pushd \!*; set prompt = "`hostname`:$cwd> "'
alias popd 'popd; set prompt = "`hostname`:$cwd> "'
Put these in your .cshrc file.
Your prompt will look something like this
looney:/home/bugs/UNIX/tips>
Previous Tip of the Week ·
Next Tip of the Week ·
Index
Greg's Home Page
Greg Hinkel / (hinkelgc AT ornl.gov)
Last Modified: Friday, 02-Sep-2005 12:52:06 EDT
Visitors: 5395 since March 18, 1996