Re: Help with 'system' seeming to return too soon...
From: Arne Jamtgaard (ajamtgaa_at_cisco.com)
Date: 09/13/04
- Next message: Greg Menke: "Re: Xah Lee's Unixism"
- Previous message: Scott W Gifford: "Re: Help with 'system' seeming to return too soon..."
- In reply to: Scott W Gifford: "Re: Help with 'system' seeming to return too soon..."
- Next in thread: A. Sinan Unur: "Re: Help with 'system' seeming to return too soon..."
- Reply: A. Sinan Unur: "Re: Help with 'system' seeming to return too soon..."
- Reply: Scott W Gifford: "Re: Help with 'system' seeming to return too soon..."
- Reply: MPB: "Re: Help with 'system' seeming to return too soon..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 13 Sep 2004 13:45:43 -0600
Scott W Gifford wrote:
> Arne Jamtgaard <ajamtgaa@cisco.com> writes:
>>I've got a script that, among other things, needs to source a
>>file to set a bunch of environment variables before it runs an
>>install script. Once the install is complete, the script uses
>>the installed files to do some more configuration steps.
> That's likely to be part of your problem. Each system() command is
> executed in a new process, so when you do system(". file"), it creates
> a new process, sets the environment variables in that process, then
> that process exits; the environment in your program is unaffected, and
> the environment in all future system calls is unaffected. To fix
> this, You can either turn this into one shell command or shell script,
> or else parse vpnenv.sh yourself and set %ENV appropriately.
I had hoped by stringing the commands together with semicolons (like
I can on the command line) that I could get around this problem. So
even though they are all quoted together, 'system' will pull each
command off separately and run them in individual shells? Dang.
That's why I kept tacking on the source command - one shell per
quoted line, as opposed to one per command.
This has got to be a problem that others have surmounted - how can
you use 'system' to run a command with a bunch of environment
variables already set?
Arne
- Next message: Greg Menke: "Re: Xah Lee's Unixism"
- Previous message: Scott W Gifford: "Re: Help with 'system' seeming to return too soon..."
- In reply to: Scott W Gifford: "Re: Help with 'system' seeming to return too soon..."
- Next in thread: A. Sinan Unur: "Re: Help with 'system' seeming to return too soon..."
- Reply: A. Sinan Unur: "Re: Help with 'system' seeming to return too soon..."
- Reply: Scott W Gifford: "Re: Help with 'system' seeming to return too soon..."
- Reply: MPB: "Re: Help with 'system' seeming to return too soon..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|