Csh, alias substitution, & backslash

Stephen Brooks brooks at ge-dab.ge.com
Tue Nov 13 00:24:25 AEST 1990


  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.  For example (using
the above aliases):

==================== this does what I expect ==================== 

        % ls
        file1           file2           file3
        % rm *
        rm: remove file1? n
        rm: remove file1? n
        rm: remove file1? n
        % ls
        file1           file2           file3
        % \rm *
        % ls
        %

==================== this does not do what I expect ==================== 

        % cd
        /usr/users/steve
        % \cd
        cd: Command not found.

So, why does the \ prevent the C-shell from recognizing the builtin
command as well as preventing alias substitution?  Feature?  Bug?
--
%% Stephen (Steve) M. Brooks       %% brooks at ge-dab.ge.com              %%
%% GE Simulation & Control Systems %% ...!uunet!ge-dab.ge.com!brooks    %%
%% P.O. Box 2825, Rm. 1370         %% ...!uunet!sunny.dab.ge.com!brooks %%
%% Daytona Beach, FL  32115-2825   %% voice: (904) 239-4855             %%



More information about the Comp.unix.questions mailing list