Problem: aliases and exec in shells

Kartik Subbarao subbarao at phoenix.Princeton.EDU
Fri Oct 26 06:52:18 AEST 1990


In article <427 at decvax.decvax.dec.com.UUCP> evans at decvax.DEC.COM writes:
>	% csh
>	% alias ls 'ls -F'
>	% exec ls
>
>The result would be simply the results of running the ls command without
>any arguments, rather than running the ls command with the argument -F.
>
>The manuals and books that I have looked through don't define what the
>behavior is suppose to be in this case, and looking through the sources
>shows that aliases are in fact ignored. 

>Does the current behavior seem intuitive to people? Am I just expecting
>something which I really shouldn't be? Your opinions are desired as I am
>debating if I will ask certain vendors to change the behavior to pay
>attention to the alias if it exists.

Well..... the problem might not be as bad as the shell's handling of 'exec'.
I think it just has to do with alias interpretation.

The thing with aliases is that the shell will only interpret an alias like
alias ls 'ls -F' if it's the first thing in the command line. (or the first
thing after a "|" , or enclosed in a ``, or the like something.) So even after 
alias foo '| more', and typed w foo, it would certainly not do w | more.

It WOULD be nice if csh had a "global" alias option, but then there's the 
chicken and egg problem of resourcing your global alias file after you've
already done so. 

i.e 

alias foo '| more' 

is a global alias. The next time you sourced this file it might be interpreted
as 

alias '| more' '|more' which would make no sense.

I guess this could be turned off during alias addition. Any other ideas?


				-Kartik









>
>- Marc
>
>-- 
>===========================================================================
>Marc Evans - WB1GRH - evans at decvax.DEC.COM  | Synergytics     (603)635-8876
>      Unix and X Software Contractor        | 21 Hinds Ln, Pelham, NH 03076
>===========================================================================



(I need a new .signature -- any suggestions?)
subbarao@{phoenix or gauguin}.Princeton.EDU -|Internet
kartik at silvertone.Princeton.EDU (NeXT mail)       -|	
SUBBARAO at PUCC.BITNET			          - Bitnet



More information about the Comp.unix.programmer mailing list