More to the point, environment variables are part of every process (rather than just a login session). A process inherits variables with values from the environment of its parent when it starts. From then on they're independent of the parent. They're not a bolt-on but a fundamental part of the Unix process design.
David Kim Helliwell <[EMAIL PROTECTED]> wrote: > The environment variables have nothing to do with the shell. > The only thing the shell does is give you a way to set environment > variables, and different shells have different syntax for that. But > environment variables are a property of your login session, not > of the shell. > > So the short answer is: Perl does not need to know or care about what > shell you're running in (although that's available as the environment > variable SHELL). Perl scripts just get the environment variables for > "free" as part of the startup. > > Hope that answers it. > > Kim Helliwell > [EMAIL PROTECTED] > Homepage: http://homepage.mac.com/kimgh > > On Jul 28, 2005, at 8:10 PM, John Horner wrote: > > > Recently there was a change at work -- all http access now needs to > > go through a proxy. > > > > So if I have a script using LWP::UserAgent or similar, I have to add > > > > $UA->proxy( ['http'] , 'http://proxy.fake.com:8080' ); > > > > to all my scripts. Which is a big pain. So a *NIX guy said "you > > shouldn't need to do that if you can add an environment variable to > > your shell". > > > > So, as I use tcsh, not bash, which is the default nowadays, I added > > this to .tcshrc: > > > > setenv http_proxy http://proxy.fake.com:8080 > > > > and it seemed to work, but leaving aside the specifics of the > > scripts, how would Perl "know" that I use tcsh, not bash? Isn't > > that a preference of the Terminal app, not of me as a user? A > > script run as a cron job, does it run using all the environment > > variables as if I'd typed its name into the Terminal? What about a > > script run from BBEdit? What if I "su root" and run it? > > > > I'd really appreciate someone explaining the relationship of script > > to shell and user. > > > > > > > >
