On Sat, 18 Oct 2003 01:10:08 -0400
Steve Grazzini <[EMAIL PROTECTED]> wrote:

> > system("ENVVAR=whatever; export ENVVAR; command");
> 
> You don't need the export.

You do if it you want to make ENVVAR exportable to the children of the
forked shell.  Otherwise it is a normal shell variable.

> $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);

Correct.  However, you may only want them set in the child. I was really
demonstrating that the command string passed to system is interpreted by
the subshell.

> > 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';

Good point. This does make it easier to read. In your example $test
should be $TEST.
 
--- 
Smoot Carl-Mitchell
Systems/Networking Consultant
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to