Re: export does not work on makefiles
From: John Gordon (gordon_at_panix.com)
Date: 12/06/04
- Next message: Uwe Mayer: "capture output of time"
- Previous message: Måns Rullgård: "Re: How to redirect "Segmentation fault (core dumped)" to err.txt?"
- In reply to: Uwe Mayer: "export does not work on makefiles"
- Next in thread: Mark Rafn: "Re: export does not work on makefiles"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 6 Dec 2004 20:20:31 +0000 (UTC)
In <cp25dr$323$1@news2.rz.uni-karlsruhe.de> Uwe Mayer <merkosh@hadiko.de> writes:
> If I have a Makefile like:
> test:
> export test=5
> why does this not cause the environment variable test to be visible after
> execution of make?
In general, whenever you run a command (such as make), that command runs
as a separate process with its own copy of the parent process' environment.
If that command makes any changes to the environment (such as exporting
variables), those changes apply only to its copy of the environment, NOT
to the environment of the parent shell which spawned that process.
And that's exactly what happened here. You ran make, which starts up a
new child process. That child process modified its environment and then
immediately exited.
It's a Very Good Thing that child processes cannot modify the environment
of parent processes. Trust me.
--
John Gordon "Between BST melee, their spells, their warders' melee,
gordon@panix.com and their warders' procs, they put out enough damage
to make monks cry." -- Dark Tyger
- Next message: Uwe Mayer: "capture output of time"
- Previous message: Måns Rullgård: "Re: How to redirect "Segmentation fault (core dumped)" to err.txt?"
- In reply to: Uwe Mayer: "export does not work on makefiles"
- Next in thread: Mark Rafn: "Re: export does not work on makefiles"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|