On Wed, May 30, 2001 at 06:50:38AM +0100, Ross Davis wrote:
> That works the finest 'cept I'm trying to put cmd2's
> output into a variable, something like:
well you're just a pita, aren't you! :)
> cmd1 && ((var=$(cmd2))&)
>> or equiv.,
>> cmd1 && ((var=`cmd2`)&)
>> No combination of brackets seem to work. Anybody
> got any idea if something like this is possible
> or another solution!?
and no combination will work as far as i can see because the ()'s create
a subshell. what this means is that the shell creates a child process
and runs the command in there - and environment variables go down to
children but never up to parents.
so, your best bet is:
cmd1 && (cmd2 > cmd2.out &); var=$(cat cmd2.out); rm cmd2.out
kevin
--
kevin at suberic.net "Maybe one day downtrodden poo-eaters will
fork()'ed on 37058400 get a fair shake in Savage Love, but it's
meatspace place: home not going to be today."
http://suberic.net/~kevin --dan savage, "savage love"
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!