🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1086

Problem: aliases and exec in shells

#1086
From: Marc Evans
Date: Thu, 25 Oct 1990 11:08
36 lines
2064 bytes
Hi -

I made an interresting discovery concerning the use of exec in shells. 
Specifically, I expected that something of the form 'exec foo' would look
through whatever search rules that would normally be used as though I had
used 'foo', and then replace my current process with what it found. This
in fact is not always the case.

In both ksh and csh, on many different vendors OS's that I have tried, if
foo is an alias for something, the alias is not used. For example, consider
the following:

	% 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. However, ksh functions could be
used, which provides for a reasonable hack-around.

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.

- Marc

-- 
===========================================================================
Marc Evans - WB1GRH - evans@decvax.DEC.COM  | Synergytics     (603)635-8876
      Unix and X Software Contractor        | 21 Hinds Ln, Pelham, NH 03076
===========================================================================
Technical Details
Message-ID: <427@decvax.decvax.dec.com.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!tut.cis.ohio-state.edu!uc!noc.MR.NET!msi.umn.edu!umeecs!umich!samsung!usc!wuarchive!decwrl!bacchus.pa.dec.com!news.crl.dec.com!decvax.dec.com!decvax!evans

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!tut.cis.ohio-state.edu!uc!noc.MR.NET!msi.umn.edu!umeecs!umich!samsung!usc!wuarchive!decwrl!bacchus.pa.dec.com!news.crl.dec.com!decvax.dec.com!decvax!evans
From: evans@decvax.dec.com (Marc Evans)
Newsgroups: comp.unix.programmer
Subject: Problem: aliases and exec in shells
Keywords: csh, ksh, exec
Message-ID: <427@decvax.decvax.dec.com.UUCP>
Date: 25 Oct 90 11:08:34 GMT
Sender: news@decvax.dec.com.UUCP
Reply-To: evans@decvax.DEC.COM
Organization: Synergytics
Lines: 36