export variables to launched process?

Mark Waddingham mark at livecode.com
Thu Feb 4 03:36:35 EST 2016

On 2016-02-04 02:57, Richard Gaskin wrote:
> I've successfully exported variables to a process run with shell, e.g.:
>     put shell("export somevar='Hello!'; ./test.sh")
> ...where test.sh simply echoes somevar to verify that it got it.
> Now I have a process I need to read and write to, but I don't know how
> to export variables to it - clues?

A process that gets launched either via shell or open process will 
inherit the environment variables set by the engine... So I think doing:

put "Hello!" into $somevar

put shell("./test.sh")
open process ... for ...

Should both have the effect that the launched process will see 'somevar' 
as specified.

Warmest Regards,


Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

More information about the use-livecode mailing list