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

  1. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!jvnc.net!rutgers!att!cbnewsj!cbnewsi!adh
  2. From: adh@cbnewsi.cb.att.com (andrew.d.hay)
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: ksh prompt (PS1) and cd
  5. Message-ID: <1992Jul21.132016.19391@cbnewsi.cb.att.com>
  6. Date: 21 Jul 92 13:20:16 GMT
  7. References: <l5n3efINN3g7@exodus.Eng.Sun.COM>
  8. Distribution: ba
  9. Organization: AT&T
  10. Lines: 43
  11.  
  12. In article <l5n3efINN3g7@exodus.Eng.Sun.COM> opensys@sunvi.Eng.Sun.COM (Anil Visariya) writes:
  13. "
  14. "Using ksh, how can one alias "cd" to change directory as well as
  15. "to set PS1 to $PWD.
  16. "
  17. "I tried:
  18. "alias cd="cd; PS1=$PWD" 
  19. "but didn't work.
  20.  
  21. don't bother with an alias.  i do
  22. export UNAME=$(uname -n) LOGNAME=$(logname) PS1='$UNAME ~$LOGNAME ${PWD##*/}/ '
  23. in my .profile.  note the SINGLE quotes.
  24. it may seem roundabout, but it's efficient.  you probably don't need
  25. uname or logname, but at one time i had logins on 13 machines, some
  26. as different user ids!  the pwd stuff gives just the current directory,
  27. not the whole path.
  28.  
  29. "Also I frequently use "ls" command as follow:
  30. "ls -la *mystring*
  31. "to get list of files whose name contain 'mystring' in its name.
  32. "How can I create an alias for the same?
  33. "
  34. "I tried: 
  35. "alias llnew="ls -la '*'\!*'*' "
  36. "but didn't work.
  37.  
  38. alias myls='ls -la *mystring*'
  39. single quotes again.
  40.  
  41. "Any help?
  42. "thanks
  43.  
  44. in general: double quoted stuff is evaluated at alias creation, single
  45. quoted stuff at alias execution.
  46.  
  47. "Anil 
  48.  
  49.  
  50. -- 
  51.         +--------------------------------------------------------------+
  52. Andrew Hay    |         I want to lie, shipwrecked and comatose -           |
  53. a_d_hay@att.com    |              Drinking fresh mango juice...               |
  54.         +--------------------------------------------------------------+
  55.