home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 15911 < prev    next >
Encoding:
Text File  |  1993-01-25  |  1.7 KB  |  56 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!highlite!dlreed
  3. From: dlreed@highlite.uucp (David L. Reed)
  4. Subject: Re: ksh prompt
  5. Message-ID: <1993Jan24.163848.15700@highlite.uucp>
  6. Organization: Gotham Communications Research
  7. References: <C17DJ4.FoA@sdf.lonestar.org> <1993Jan22.120028.18986@mfltd.co.uk>
  8. Date: Sun, 24 Jan 1993 16:38:48 GMT
  9. Lines: 45
  10.  
  11. dnh@mfltd.co.uk (Des Herriott) writes:
  12.  
  13.  
  14. >In article <C17DJ4.FoA@sdf.lonestar.org>, larry@sdf.lonestar.org (Larry D. Clark) writes:
  15. >> 
  16. >>     I am using ksh on a platform running Unix 5.4 at work and would 
  17. >>     like to have my PS1 to reflect the current working directory.
  18. >>     Does any one have any ideas how to do it??
  19.  
  20. >Probably the best way of doing it is to write a function:
  21.  
  22. >  function _cd 
  23. >  {
  24. >    \cd "$@" || return
  25. >    PS1="`basename $PWD` $ "     # or something to that effect
  26. >  }
  27.  
  28. >  alias cd=_cd
  29.  
  30. >Then just stick that lot in your .profile or .kshrc.
  31.  
  32. Sorry but this seems very redundant to me.  Just set PS1 and export
  33. like this in your .profile:
  34.  
  35.     PS1=`$PWD $ `
  36.     export PS1
  37.  
  38. Then your prompt will always contain your current directory followed
  39. by whatever you set with it--in this case:
  40.  
  41.     /usr/home/you $
  42.  
  43.  
  44.  
  45. >Des.
  46. >-- 
  47. >Des Herriott,           /     "...and I hate, and I hate, and I hate,
  48. >Micro Focus, Newbury.  /             elevator music..."
  49. >+44 (0635) 565354     /
  50. >dnh@mfltd.co.uk      /                   -- Tori Amos, Little Earthquakes.
  51. -- 
  52. David L. Reed:  dlreed@gotham.com  dlreed@highlite.uucp  uunet!highlite!dlreed
  53.          Come join us at highlite... Public Access Unix for DC/MD/VA.
  54.    D.C. Metro (301)924-5998, Comms set to 8N1.  login: guest  passwd: guest 
  55.      Taking calls at 1200/2400/9600+ (V.32bis/V.42bis w/error correction)   
  56.