Path: 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 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 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 :-).