🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #94

Re: ksh prompt (PS1) and cd

#94
From: andrew.d.hay
Date: Tue, 21 Jul 1992 13:20
43 lines
1770 bytes
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...		       |
		+--------------------------------------------------------------+
Technical Details
Message-ID: <1992Jul21.132016.19391@cbnewsi.cb.att.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!jvnc.net!rutgers!att!cbnewsj!cbnewsi!adh
References: <l5n3efINN3g7@exodus.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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