How to alias 'exit' in csh?

Rob McMahon cudcv at warwick.ac.uk
Sat Sep 23 20:43:10 AEST 1989


In article <38719 at bu-cs.BU.EDU> madd at std.com writes:
>Use:
>	alias exit "source ~/.logout ; 'exit'"
>Aliasing doesn't happen on quoted names, which I often make use of when I
>really, really want to override my aliasing.

I replied to the author, but it occurred to me that this is a useful trick
that people might not know.  The above doesn't work, because quoting avoids
builtins as well as aliases, so it tries to look for a non-builtin command
called exit, which it doesn't find.  However

	alias exit "source ~/.logout ; ''exit"

does work, it avoids aliases but will still catch builtins.  This is useful if
someone nasty manages to alias your alias and unalias commands for you (with

	alias \unalias ...
	alias \alias ...

csh won't normally let you alias alias).  You just do

	''unalias alias
	unalias unalias

Rob
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv at uk.ac.warwick             ARPA:   cudcv at warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England



More information about the Comp.unix.questions mailing list