home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / shell / 3192 < prev    next >
Encoding:
Internet Message Format  |  1992-07-29  |  942 b 

  1. Path: sparky!uunet!wupost!swbatl!texbell!swuts!jc8922
  2. From: jc8922@swuts.sbc.com (Jeff Conner)
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: ksh prompt (PS1) and cd
  5. Message-ID: <1386@swuts.sbc.com>
  6. Date: 29 Jul 92 17:26:08 GMT
  7. References: <l5n3efINN3g7@exodus.Eng.Sun.COM> <1992Jul21.132016.19391@cbnewsi.cb.att.com>
  8. Distribution: ba
  9. Organization: Southwestern Bell Telephone Company
  10. Lines: 23
  11.  
  12. >"
  13. >"Using ksh, how can one alias "cd" to change directory as well as
  14. >"to set PS1 to $PWD.
  15. >"
  16. >"I tried:
  17. >"alias cd="cd; PS1=$PWD" 
  18. >"but didn't work.
  19. >
  20.  
  21. PS1='$PWD $ '            export PS1
  22.  
  23. This will give you the current PATH in your prompt everytime you 'cd'.
  24. e.g.,
  25.         /usr $ echo $PATH    # current directory is /usr
  26.         /usr
  27.         /usr $ cd bin
  28.         /usr/bin $         # notice prompt has changed
  29.  
  30. -- 
  31. Jeff Conner   314-235-0274    |  uunet!swuts!jc8922
  32. Southwestern Bell Telephone     |  -or- jc8922@swuts.sbc.com
  33. One Bell Center     23-K-07    |  
  34. St. Louis, Missouri 63101-3099    | 
  35.