home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / shell / 3855 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.9 KB  |  51 lines

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