Path: utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!sunic!nuug!ifi!digre!anders From: anders@digre.uio.no (Anders Ellefsrud) Newsgroups: gnu.bash.bug Subject: Re: bash bug report Message-ID: Date: 13 Dec 89 17:28:36 GMT References: <8912030428.AA01426@kailand.kai.com> <3749@convex.UUCP> <13693@reed.UUCP> Sender: anders@ifi.uio.no Lines: 33 > >I've been told by devout ksh users that it's missing autoload functions. > > autoload() { > echo $1 \(\) \{ echo . $2 2\>\&1 \; . $2 \} > /tmp/au.$$ > . /tmp/au.$$ > rm /tmp/au.$$ > } > I see a few problems with that function. I think this is better: autoload() { eval `echo "$1" "() { args=\$@ ; . $2 ; set -- \$args; $1 \$@ }"` } Note: I said BETTER, not PERFECT! It will not handle funny arguments like 'foo bar'. Usage: autoload foo ~/lib/the_foo_function . . . foo bar ... works as expected, but foo 'gaz onk' does not. --- anders@ifi.uio.no