Article View: gnu.bash.bug
Article #1040Re: for without in (or even with it)
From: Bill Trost
Date: Thu, 14 Dec 1989 20:08
Date: Thu, 14 Dec 1989 20:08
47 lines
1850 bytes
1850 bytes
OK, *now* I write:
spam () { for i in "$@"; do echo $i; done }
and if I run
spam "a b" c
I get
a b c
Similarly, if I leave out the double-quotes, then
spam "a b" c
produces
a
b
c
It looks like the arguments to functions aren't getting passed quite
right. This looks familiar; is it one of Chet's
I-have-fixed-this-and-sent-the-patch-to-Brian things?
This series of problems was generated by my attempts to fix the
problem Anders Ellefsrud <anders@ifi.uio.no> noted when he posted a
*corrected* autoload function. (Silly me, I only implemented the
load, I didn't have it *do* anything!)
BTW, the current candidate for autoload is:
autoload() {
eval $1 '() { args=$@ ; . '$2' ; set -- $args ; return '$1' "$@" }'
}
It really should check to see that it has two arguments; I got really
confused when I kept forgetting to provide the filename to
autoload.... Also should check $2 for a leading slash and prepend
$PWD/ if it's absent.
You need the return in case the autoloaded function returns something;
the "$@" is what this message is about; it *should* be right, although
it doesn't work as expected (hence this posting).
Bryan, you asked something about "what is autoload", essentially. I
think we're probably all basing our discussion on what we've picked up
from emacs' autoload. I'll spare you the agony of reading the output
of C-h f autoload :-).
Technical Details
Message-ID:
<13746@reed.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!zephyr.ens.tek.com!tektronix!reed!trostReferences:
<13739@reed.UUCP> <8912140908.AA05253@sbphy.Ucsb.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!zephyr.ens.tek.com!tektronix!reed!trost From: trost@reed.bitnet (Bill Trost) Newsgroups: gnu.bash.bug Subject: Re: for without in (or even with it) Message-ID: <13746@reed.UUCP> Date: 14 Dec 89 20:08:15 GMT References: <13739@reed.UUCP> <8912140908.AA05253@sbphy.Ucsb.EDU> Sender: news@reed.UUCP Distribution: gnu Lines: 47