Newsgroups: comp.unix.questions Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Subject: Re: How to alias EXIT or any CSH command Message-ID: <1991Apr3.172209.13085@athena.mit.edu> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology References: <1991Apr1.165435.4687@berlioz.nsc.com> <1991Apr3.150825.7074@athena.mit.edu> Date: Wed, 3 Apr 91 17:22:09 GMT Lines: 31 In article <1991Apr3.150825.7074@athena.mit.edu>, jik@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@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710