|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Richard Neill on 7/22/2008 8:04 PM:
| This prints "Match-1", but does not print "Match-2".
|
| The only way to get data out of the read-subshell is by something like
| "exit 2", and looking at $?
You can also use files. The position within a seekable file is preserved
from child to parent, but once you are using files, you might as well go
with the file contents.
| It's already possible to export a variable into the environment, and for
| subshells to inherit variables from the main script. Do we need a new
| keyword to achieve the reverse? Is there any way to make sure that
| variables defined at [a] can be made to still exist at [b] ?
A new keyword is insufficient. This is something that is fundamentally
not provided by Unix systems - short of using the file system, there
really isn't a way to pass arbitrary information from a child process back
to the parent.
But maybe the 'source' builtin is what you are looking for, to execute a
script in the same context rather than forking off a child.
- --
Don't work too hard, make some time for fun as well!
Eric Blake ebb9@xxxxxxx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkiGmkYACgkQ84KuGfSFAYAFpQCeMsQjKYSjL6iQuzbwBO0muYDY
QVYAoIxIozi5kQvkOSC0oBSUrJYRQcZJ
=sZ1V
-----END PGP SIGNATURE-----
|
|