export variable inheritance question

Scott James Remnant scott at netsplit.com
Sat Oct 3 05:25:48 BST 2009


On Fri, 2009-10-02 at 17:54 -0700, Garrett Cooper wrote:

> "export VAL=1" is a variable available in the environment, and it's
> accessible via the shell, but only for the current job.
> 
Actually, I don't think this does anything like what you think ;-)

export "VAL=1" would place any variable with that *literal* name into
events. Since you have $VAL not ${VAL\=1}.  This is a no-op.

> "export VAL
> env VAL=1" is a variable available in the environment, and it's
> accessible via the shell for all child dependent jobs.
> 
Right.  That's exactly what it means.

>     What I'm trying to determine is whether or not it's possible to
> find a better way outside of initctl where it wouldn't inherit
> environment variables in jobfiles, because this seems like
> functionality that's not correct, but it's not wrong due to there not
> being specific requirements for it to act one specific way (maybe this
> is a side-effect of the fact that the export stanza doesn't have any
> documentation that I've found).
> 
There's full documentation in the init(5) manpage.

Have you not tried:

  env VAL=1

? :-)

This sets the default value of $VAL to 1 unless otherwise overridden
with the start command or by events, but does not export it into the
event environment.

Scott
-- 
Have you ever, ever felt like this?
Had strange things happen?  Are you going round the twist?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/upstart-devel/attachments/20091003/535fd7f5/attachment.pgp 


More information about the upstart-devel mailing list