[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: example implementation (was: Re: DRAFT: Fixing the architecture query options of dpkg.



On Mon, Jan 11, 1999 at 08:48:55PM +0000, Jules Bean wrote:
> On Mon, 11 Jan 1999, Marcus Brinkmann wrote:
> > I tried to implement this but failed somehow. Could somebody give a small
> > example how to do it in perl?
> > 
> > task: Set a environment variable and run a program which options are in an
> > array in this environment.
> 
> Um..
> 
> well, if you're simply trying to pass environment variables to a program,
> the perl might look like this:
> 
> #!/usr/bin/perl
> #
> # modify environment and run command
> 
> $ENV{'ARCH_X_Y_Z'} = 'a-b-c';
> 
> system($ARGV[1]);
> 
> ..or have I misunderstood?..

You are doing too much C, it's $ARGV[0] in perl ($0 is the prog name) :)

Mmmmh. I changed "system($ARGV[1]);" to "exec @ARGV;" and it seems to work
better. Seems my problem was that I tried to set the environment variables
with "export" etc. Thanks.

Marcus

-- 
"Rhubarb is no Egyptian god."        Debian GNU/Linux        finger brinkmd@ 
Marcus Brinkmann                   http://www.debian.org    master.debian.org
Marcus.Brinkmann@ruhr-uni-bochum.de                        for public  PGP Key
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       PGP Key ID 36E7CD09


Reply to: