Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!sgi!dragon!arthur From: arthur@sgi.com (Arthur Evans) Newsgroups: comp.unix.questions Subject: Re: Csh, alias substitution, & backslash Message-ID: <1990Nov14.011717.10928@relay.wpd.sgi.com> Date: 14 Nov 90 01:17:17 GMT References: <6663@ge-dab.ge.com> Sender: news@relay.wpd.sgi.com ( CNews Account ) Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 33 In article <6663@ge-dab.ge.com> brooks@ge-dab.ge.com (Stephen Brooks) writes: > > In the C-shell, you can prevent alias substitution by preceding the >aliased command with a backslash. For example, you might have: > > % alias rm > rm -i > % alias cd > cd !* ; pwd > >However, why does "\rm" work, but "\cd" does not? Yes, I realize that >"cd" is a C-shell builtin command, but I haven't been able to find any >discussion on how the \ prevents alias substitution. Well, here's my shot in the dark. The csh is setting the high bit on the first character of your command to "quote" it--prevent it from matching a metacharacter when the shell does filename substitution. So your command, with high bit set, is searched for in the list of builtin commands. When the shell doesn't find it there it does filename substitution--"globbing"--in the course of which it strips the high bit. Then it searches for your command, sans high bit, in the hash list and/or search path. In the case of "rm," the shell finds what it's looking for. In the case of "cd," it doesn't. OK -arthur -- "If I had all the money I'd spent on drink ... I'd spend it on drink." -- Sir Henry Rawlinson Arthur Evans arthur@rawlinson.wpd.sgi.com