|
![](/i/fill.gif) |
Daniel Bastos wrote:
> I hope this can work, somehow.
No. What you want to look at is the command called "source".
If you want to arbitrarily change the shell's behavior, and your program is
called "xyz", then what you want is the commands
% ./xyz ; source ./pdq
and then have your "xyz" program output a file of shell commands (with
setvar and cd and such) to a file called "pdq". Environment variables are
like the working directory - they are copied per-process.
Wow, that was surprisingly easy to find. I expected to spend 10 minutes
coming up with the right google terms, even already knowing how all this
works. Check this out:
http://perl.plover.com/yak/commands/
Note that the "source" command basically says "Here's a shell script - don't
fork before interpreting it." Note also that many bits of this are different
in Windows, DOS, etc. Note also that if it's your program for which you're
setting up the environment this way, you're doing it wrong. (I.e., if you
stick stuff in "environment variables" that change on a per-program basis,
that's not really part of your "environment", and that's exactly why you're
having those troubles. Just as a philosophical point.)
Hope that helps you understand things.
--
Darren New, San Diego CA, USA (PST)
Understanding the structure of the universe
via religion is like understanding the
structure of computers via Tron.
Post a reply to this message
|
![](/i/fill.gif) |