home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!malgudi.oar.net!caen!spool.mu.edu!wupost!darwin.sura.net!europa.asd.contel.com!chapin
- From: chapin@ssvax.gte.com (Barry Chapin)
- Subject: Re: Need help putting PWD in PROMPT
- Message-ID: <1992Sep8.194041.29317@europa.asd.contel.com>
- Sender: news@europa.asd.contel.com (News)
- Nntp-Posting-Host: 100.14.40.6
- Organization: GTE/SCSD
- X-Newsreader: Tin 1.1 PL5
- References: <1992Sep8.152514.24851@orlith.bates.edu>
- Date: Tue, 8 Sep 1992 19:40:41 GMT
- Lines: 37
-
- Preston Beach (pbeach@abacus.bates.edu) wrote:
- : Dear Netland,
- : I want to get my prompt to give my current working directory all the time.
- : I need this for an Ultrix and BSD system. If anyone knows of a script or
- : shell file which will do this please send it my way. Thanks very much.
- : -Preston
- : p.s. I am using csh. btw
- :
- : Preston Beach
- : Email : pbeach@abacus.bates.edu
- : Bates College
- : Lewiston, ME
-
- In you .cshrc file, you want to put a line like this:
- if ($?prompt) then set prompt="Preston at `pwd` \!: "
-
- this will give you a prompt that look like this
- Preston at /usr/Preston 1:
-
- when you log in. The 1 is the number of the current
- command that you are entering, useful for history information.
- This will set it correctly, until you cd to another directory.
- Thus, you must also put this line in you .cshrc file:
- alias cd 'cd \!*;set prompt-"Preston at `pwd` \\!: ";ls -C'
-
- Note that this also adds the feature of doing an ls of the
- directory which you changed to. The line basically redefines
- the cd command to cd to the text which occurs on the remainder of
- the line after you typed cd, and then also sets your prompt to be
- what you enter in double quotes, and gives you the history number of
- that command and does the ls for you. You do not have to
- include the history or the ls stuff if you dont want, I just copied
- it from my file.
-
- Good Luck.
- -BC.
-
-