🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1168

Re: Problem: aliases and exec in shells

#1168
From: John R. MacMillan
Date: Fri, 02 Nov 1990 15:34
31 lines
1539 bytes
evans@decvax.dec.com (Marc Evans) writes:

|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.

In the ksh manual, you'll probably find this behaviour documented in
the section on alias expansion.  Alias expansion is performed on the
first word, but not its arguments, barring some exceptions.  One
exception can get you the behaviour you want:  if the first word is an
alias whose expanded value ends in a space, alias expansion is
performed on the next word.  So you can get the behaviour you want in
ksh with:

$ ksh
$ alias ls='ls -F'
$ alias exec='exec '
$ exec ls

Also handy for nohup.
-- 
John R. MacMillan       | I'm in love with a McDonald's girl
SCO Canada, Inc.        | She's an angel in a polyester uniform.
john@sco.COM            |      -- barenaked ladies
Technical Details
Message-ID: <1990Nov02.153458.21606@sco.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!ncrcan!scocan!john
References: <427@decvax.decvax.dec.com.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!ncrcan!scocan!john
From: john@sco.COM (John R. MacMillan)
Newsgroups: comp.unix.programmer
Subject: Re: Problem: aliases and exec in shells
Keywords: csh, ksh, exec
Message-ID: <1990Nov02.153458.21606@sco.com>
Date: 2 Nov 90 15:34:58 GMT
References: <427@decvax.decvax.dec.com.UUCP>
Sender: news@sco.com (News administration)
Organization: SCO Canada, Inc. (formerly HCR Corporation)
Lines: 31