Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Apr 1998 13:51:49 -0700
From:      Leonard <leonardc9@usa.net>
To:        Bruce Albrecht <bruce@zuhause.mn.org>
Cc:        questions@FreeBSD.ORG
Subject:   Re: Setting shell environment vars in perl
Message-ID:  <3.0.5.32.19980413135149.007cb630@pop.slip.net>
In-Reply-To: <199804130510.AAA14499@zuhause.mn.org>
References:  <3.0.5.32.19980412125035.007b7e30@pop.slip.net> <3.0.5.32.19980412125035.007b7e30@pop.slip.net>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 12:10 AM 4/13/98 -0500, you wrote:
What's interesting is that I was trying to set the home directory in a
sub-shell.  The problem for me is that the system runs perl scripts as
Nobody rather than my user account, and I needed to set HOME so that a
program could run.  Anyways, I set up the script on another FreeBSD
system where httpd is configured differently and everything seems
fine.

Leonard

>Setting environmental variables in perl scripts do not change the
>environment variables in the shell that invoked it, but any children
>of the perl script (i.e., something that uses fork, system, exec,
>backticks, pipes in open statements) will have the environment
>variables you set in the script.  This is not a perl limitation, it's
>the way environment variables work on all Unix operating systems.
>
>The closest you can get to having a perl script set environment
>variables for your shell would be to do something like
>  eval `perlscript`
>and have perlscript output something like
>  VAR=value; export VAR     (bourne, bash, ksh)
>or
>  setenv VAR value          (csh, tcsh)
>
>
>
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.5.3 for non-commercial use <http://www.pgp.com>;

iQA/AwUBNTJ64+AvLUJUxjQXEQIyOwCfXHcLf7zNEy0bN/7yXPwgt6pX5ZMAoND/
gB9W8tLaFo2WZdg0XgbSYy8i
=jdVF
-----END PGP SIGNATURE-----


--
Support the Blue Ribbon Campaign for free speech online        ()
http://www.eff.org/blueribbon.html                             /\
"Those who will not reason perish in the act.
Those who will not act, perish for that reason." - W. H. Auden

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.5.32.19980413135149.007cb630>