On Fri, Oct 17, 2003 at 04:05:10PM -0700, Smoot Carl-Mitchell wrote:
> Steve Grazzini <[EMAIL PROTECTED]> wrote:
>
> > Have you actually tried ". perlscript" ? :-)
>
> This will not work.
Yes, anyone who tries it will realize this immediately. :-)
> system("ENVVAR=whatever; export ENVVAR; command");
You don't need the export.
% FOO=whatever /bin/echo $FOO
whatever
$FOO goes in the child's environment, but not the parent's. And
since environment variables aren't shell-specific (like the OP's
aliases) you can also set them from Perl.
$ENV{FOO} = 'whatever';
system qw(echo $FOO);
> system("ksh -c \"export TEST=hello; echo \\\$TEST\"");
>
> Note the quoting gets really convoluted
No kidding... Sometimes the list form of system() makes this easier,
and non-interpolating quotes always help.
system qw(ksh -c), 'TEST=hello; echo $test';
> Better, yet, write the shell functionality in Perl and do away with
> the subshell calls altogether. ;-)
Hear, hear!
--
Steve
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]