home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!jvnc.net!rutgers!att!cbnewsj!cbnewsi!adh
- From: adh@cbnewsi.cb.att.com (andrew.d.hay)
- Newsgroups: comp.unix.shell
- Subject: Re: ksh prompt (PS1) and cd
- Message-ID: <1992Jul21.132016.19391@cbnewsi.cb.att.com>
- Date: 21 Jul 92 13:20:16 GMT
- References: <l5n3efINN3g7@exodus.Eng.Sun.COM>
- Distribution: ba
- Organization: AT&T
- Lines: 43
-
- In article <l5n3efINN3g7@exodus.Eng.Sun.COM> opensys@sunvi.Eng.Sun.COM (Anil Visariya) writes:
- "
- "Using ksh, how can one alias "cd" to change directory as well as
- "to set PS1 to $PWD.
- "
- "I tried:
- "alias cd="cd; PS1=$PWD"
- "but didn't work.
-
- don't bother with an alias. i do
- export UNAME=$(uname -n) LOGNAME=$(logname) PS1='$UNAME ~$LOGNAME ${PWD##*/}/ '
- in my .profile. note the SINGLE quotes.
- it may seem roundabout, but it's efficient. you probably don't need
- uname or logname, but at one time i had logins on 13 machines, some
- as different user ids! the pwd stuff gives just the current directory,
- not the whole path.
-
- "Also I frequently use "ls" command as follow:
- "ls -la *mystring*
- "to get list of files whose name contain 'mystring' in its name.
- "How can I create an alias for the same?
- "
- "I tried:
- "alias llnew="ls -la '*'\!*'*' "
- "but didn't work.
-
- alias myls='ls -la *mystring*'
- single quotes again.
-
- "Any help?
- "thanks
-
- in general: double quoted stuff is evaluated at alias creation, single
- quoted stuff at alias execution.
-
- "Anil
-
-
- --
- +--------------------------------------------------------------+
- Andrew Hay | I want to lie, shipwrecked and comatose - |
- a_d_hay@att.com | Drinking fresh mango juice... |
- +--------------------------------------------------------------+
-