[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, 11 Jan 1999, Marcus Brinkmann wrote:
> On Mon, Jan 11, 1999 at 10:09:15AM +0000, Jules Bean wrote:
> > The standard approach is to eval the output of a program.  c.f. 
> > 
> > eval `ssh-add`
> > 
> > as used by ssh.
> 
> I will suggest something like this in the documentation then.
> 
> I was a bit surprised that the following does not work:
> 
> #!/bin/sh
> # output
> echo ABC=abc
> 
> #!/bin/sh
> # trial
> echo $ABC
> 
> flora:/tmp# `sh output` sh trial
> bash: ABC=abc: command not found
> flora:/tmp# sh `sh output` sh trial
> ABC=abc: ABC=abc: No such file or directory
> 
> But:
> flora:/tmp# ABC=abc sh trial
> abc

Colour me also surprised ;-)

Although I can imagine why it doesn't work.

One approach which will work is

env `sh output` sh trial

However, an approach more consistent with the general design of
enviornment variables would be something like this:

dpkg-env <env-options go here> debian/rules binary

Either explicitly, or called implicitly within dpkg-buildpackage.

The idea is that dpkg-env sets the enviroment vars correctly and executes
the program debian/rules in that environment, without attempting to mess
with the enclosing environment.

Jules

/----------------+-------------------------------+---------------------\
|  Jelibean aka  | jules@jellybean.co.uk         |  6 Evelyn Rd	       |
|  Jules aka     | jules@debian.org              |  Richmond, Surrey   |
|  Julian Bean   | jmlb2@hermes.cam.ac.uk        |  TW9 2TF *UK*       |
+----------------+-------------------------------+---------------------+
|  War doesn't demonstrate who's right... just who's left.             |
|  When privacy is outlawed... only the outlaws have privacy.          |
\----------------------------------------------------------------------/


Reply to: