Sys V questions

Don Ingli AGRISCS at umcvmb.missouri.edu
Wed Jan 3 05:23:52 AEST 1990


1) here is a repost that I made to unix-wiz for bitneters...
Subject: RE: pwd in your PS1

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...

 2) alias...  This is a command that I miss from BSD (the only thing I miss
    :-)  )    You can simulate an alias by using the above method.

    Lets say you want to use the command listem instead of ls....

    listem() {
    ls
             }
    put that in your .profile and it will create a shell function'
    called listem that will run the unix cmd(s) on the second line.

    Does this Help??


 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.questions mailing list