Thomas.
(Don't you love how the AI lab named all of their machines after breakfast
cereals? :-)
Funny, Doug Gwyn and I were having a discussion about this just last
weekend on comp.unix.questions.
The problem with the v9 syntax for exportable functions is that it requires
a C library `getenv()' that ignores the definitions and shells that
understand them (for example, this would choke a "regular" System V /bin/sh
started under bash -- either you would have some very strangely-named shell
variables, or the shell would just get all confused).
Bash does have exportable functions; the syntax is "name=() {value}", which
I think is a nice compromise:
kiwi$ echo $BASH_VERSION
1.03.59
kiwi$ type foo
foo is a function
foo () { echo this is foo }
kiwi$ export foo
kiwi$ bash
kiwi$ foo
this is foo
kiwi$
Chet Ramey
Chet Ramey "We are preparing to think about contemplating
Network Services Group, CWRU preliminary work on plans to develop a
ch...@cwjcc.INS.CWRU.Edu schedule for producing the 10th Edition of
the Unix Programmers Manual." -- Andrew Hume
Bash 1.03 can export functions to other bashes.
Upon reading in the environment, if a string of the form "name=() {" is
found, then that is a function definition. Perhaps I can support the
other syntax as well.
toplevel$ foo () { echo bar }
toplevel$ export foo
toplevel$ printenv foo
foo=() { echo bar }
toplevel$ bash
bash$ type foo
foo is a function
foo () { echo bar }
Brian Fox