How to alias EXIT or any CSH command
Jonathan I. Kamens
jik at athena.mit.edu
Thu Apr 4 03:22:09 AEST 1991
In article <1991Apr3.150825.7074 at athena.mit.edu>, jik at athena.mit.edu (Jonathan I. Kamens) writes:
|> Now, as for what I think is the "best" way to do it:
|>
|> alias exit 'MY_STUFF_HERE; \exit'
|>
|> Back-slashing a character quotes it, which makes the shell treat it
|> differently when doing alias expansion. This is how I've always seen alias
|> loops avoided. Using "" is just about the same. Using a variable to put the
|> variable in is just a bit of overkill.
Of course, my answer is wrong :-(
The rest of my posting was right, but when I went to post my own entry into
the competition, I screwed up when I was testing it, as Gillmer Derge kindly
pointed out to me in E-mail. I forgot that the check for built-ins takes
place before quoting is removed from strings.
The - alias exit 'MY_STUFF_HERE; ""exit' - appears to be the most correct
solution.
Sorry about that.
Incidentally, I agree with Bruce Varney that a better solution is to use
another shell. The quoting rules for csh and tcsh are arcane and magical, and
in many ways unplanned. Yuck.
--
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik at Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8085 Home: 617-782-0710
More information about the Comp.unix.questions
mailing list