🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #1041

Re: for without in (or even with it)

#1041
From: Chet Ramey
Date: Fri, 15 Dec 1989 19:25
33 lines
1670 bytes
In article <13746@reed.UUCP> trost@reed.bitnet (Bill Trost) writes:

	[about "$@" not working right in shell functions]

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

You got it.

It's not the arguments to the function, it's the problem with "$@" 
being interpreted the same as $@ (there is no special-casing for the
quotes in vanilla bash-1.04).

>BTW, the current candidate for autoload is:
>	autoload() {
>	   eval $1 '() { args=$@ ; . '$2' ; set -- $args ;  return '$1' "$@" }'
>	}

Check out <1989Dec14.212828.5302@usenet.ins.cwru.edu> (love them C-News
message-id strings!).

It is, I think (in my own highly opinionated fashion), the closest thing to
the ksh `autoload' that can be implemented as a shell function.  Bill is
right about the need for a `return' though (even if he did it wrong :-);
I have put that into mine.

Chet Ramey
-- 
Chet Ramey
Network Services Group				"Where's my froggie?"
Case Western Reserve University
chet@ins.CWRU.Edu			
Technical Details
Message-ID: <1989Dec15.192549.17778@usenet.ins.cwru.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!cwns1!chet
References: <13739@reed.UUCP> <8912140908.AA05253@sbphy.Ucsb.EDU> <13746@reed.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!cwns1!chet
From: chet@cwns1.CWRU.EDU (Chet Ramey)
Newsgroups: gnu.bash.bug
Subject: Re: for without in (or even with it)
Message-ID: <1989Dec15.192549.17778@usenet.ins.cwru.edu>
Date: 15 Dec 89 19:25:49 GMT
References: <13739@reed.UUCP> <8912140908.AA05253@sbphy.Ucsb.EDU> <13746@reed.UUCP>
Reply-To: chet@po.CWRU.Edu (Chet Ramey)
Distribution: gnu
Organization: Case Western Reserve Univ. Cleveland, Ohio, (USA)
Lines: 33