in reply to Re: simulating bash
in thread simulating bash

That's very interesting. I tried to do something like that, but I couldn't figure out how to get it to only return what variables were added from the script run.

Replies are listed 'Best First'.
Re: Re: Re: simulating bash
by graff (Chancellor) on May 15, 2004 at 06:01 UTC
    Right. If you wanted to do it all in one script, something like the following would probably be the cleanest (untested):
    # get the "output" environment from the script into a hash my %envhash = map { chomp; split( /=/, $_, 2 ) } `bash.script`; # now get the "ambient environment" and delete that from the hash: for ( `bash -c env` ) { ( my $var, undef ) = split( /=/ ); delete $envhash{$var}; }