🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1089

Re: Problem: aliases and exec in shells

#1089
From: Kartik Subbarao
Date: Thu, 25 Oct 1990 20:52
66 lines
2641 bytes
In article <427@decvax.decvax.dec.com.UUCP> evans@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@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@silvertone.Princeton.EDU (NeXT mail)       -|	
SUBBARAO@PUCC.BITNET			          - Bitnet
Technical Details
Message-ID: <3586@idunno.Princeton.EDU>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!rutgers!njin!princeton!phoenix!subbarao
References: <427@decvax.decvax.dec.com.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!rutgers!njin!princeton!phoenix!subbarao
From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao)
Newsgroups: comp.unix.programmer
Subject: Re: Problem: aliases and exec in shells
Keywords: csh, ksh, exec
Message-ID: <3586@idunno.Princeton.EDU>
Date: 25 Oct 90 20:52:18 GMT
References: <427@decvax.decvax.dec.com.UUCP>
Sender: news@idunno.Princeton.EDU
Lines: 66