pwd in your PS1

Don Ingli AGRISCS at umcvmb.missouri.edu
Fri Dec 29 12:22:30 AEST 1989


I have developed a method to put your pwd into your ps1.

The way I do it is to create a shell function in my .profile and then have
it run a program called chd .

place this in your .profile

chd() {
  . chd
}
PS1="$LOGNAME:`pwd`> "
export PS1


this creates a function chd that will run a script called chd and affect
the current environment....

now create this shell script: and name it chd

cd $*
PS1="$LOGNAME:`pwd`> "
export PS1


remember to place it in a subdirectory that is in your $PATH var.
Also, make sure you have executable permissions  chmod 700 chd  :-)

HINT: If you have a nosey co-worker/friend use chd to display a path
and then use cd to go where you want... cd wont change your prompt.
ex:
chd project
don:/usr8/don/project> cd /usr/games

your prompt will show you that you are in subdir project but actually
be in the games directory!!

Also...  chd with no args will take you to your HOME directory since it
calls cd...


Hope this helps...


 DON INGLI------------------------------------------------------------+
 UNITED STATES DEPARTMENT OF AGRICULTURE - SOIL CONSERVATION SERVICE  |
 bitnet: agriscs at umcvmb.bitnet  internet: agriscs at umcvmb.missouri.edu |
 attmail: attmail!attbl!arpa!umcvmb.missouri.edu!agriscs              |
 ALL OPINIONS IN THIS NOTE ARE OF MY OWN AND DO NOT REPRESENT THE     |
 FEDERAL GOVERNMENT OR THE UNIVERSITY OF MISSOURI-COLUMBIA -----------+



More information about the Comp.unix.wizards mailing list