Getting UNIX prompt to display curr

Lars Bo Nielsen lbn at ksuvax1.cis.ksu.edu
Tue Mar 28 01:52:34 AEST 1989


In article <2113 at cveg.uucp> jms at hcx.uucp (Michael Stanley) writes:
>
>In article <1383 at deimos.cis.ksu.edu>, lbn at ksuvax1.cis.ksu.edu (Lars Bo Nielsen) writes:
>> Simply (in CSH):
>> 
>> 1) Full pathname:
>> 	alias cd 'cd \!*; set foo=`pwd`; set prompt=$foo"% "'
>>  [ Three more examples ]
>
>Ah, but csh includes the environment variable $cwd.  This makes setting
>foo unnecessary.  It seems to me that you could remove the part that says:
>
>	set foo=`pwd`
>
>and replace every occurrence of $foo with $cwd.

You are right. Here are the modified (quicker) versions:

1) Full pathname:
	alias cd 'cd \!*; set prompt=$cwd"% "'
2) Only name of current dir:
	alias cd 'cd \!*; set foo=$cwd; set prompt=$foo:t"% "'
3) Include name of machine in prompt
	alias cd 'cd \!*; set prompt=$host":"$cwd"% "'
or	alias cd 'cd \!*; set foo=$cwd; set prompt=$host":"$foo:t"% "'

>	Michael Stanley      (...!uunet!harris.cis.ksu.edu!jms at hcx)
--
 Lars Bo Nielsen          || BITNET: lbn at KSUVAX1
 lbn at ksuvax1.cis.ksu.edu  || UUCP: ...!{rutgers,texbell,atanasoff}!ksuvax1!lbn



More information about the Comp.unix.questions mailing list