RE: set environment variable
Posted in 2008
A bit of a shameful plug, but correct on the content.
While you *can* do this, the need to do this is limited and there may be better alternatives.
What is it that you're trying to accomplish? If you do any environment changes, its only in the local shell and it can only be used in the local shell or its children.
Perhaps a use case would help ...
-G
> From: iiug@aubit.com
> To: informix-list@iiug.org
> Subject: Re: set environment variable
> Date: Fri, 21 Nov 2008 14:16:36 +0000
> CC: eferreyra@gmail.com
>
> You can't really do that..
>
> You're testing for having set something in the environment from a process
> thats been run and finished, and you cant set the environment in a parent
> process from a child process.
>
> You can't even do that from a shell script - the closest you can get is
> to 'source' the settings so they are read into the current settings. If you
> want to take this approach - you might be able to generate a 'settings' file
> and then source that, eg :
>
> $ fglgo my4gl> # my4gl generates my4gl.env
>
> $ . my4gl.env
> $ echo $MYVAR>
>
> You should be able to set the environment variables for use within the 4gl
> program by calling the C function putenv or setenv (depending on your
> platform) - but that will only set it for programs run from the 4gl program
> (eg via a RUN command).
> Of course - Aubit4GL has a "aclfgl_setenv" to make this easier ;-)
>
>
>
> HTH
>
>
>
> On Friday 21 November 2008 14:01:34 eferreyra wrote:
> > Hi, i note there is not a FGL_SETENV function in traditional Informix
> > 4GL
> >
> > Anybody has resolved how to set an environment variable (linux, bash)
> > from 4gl program??
> >
> > i need:
> >
> > $ fglgo my4gl> >
> > -- my4gl must set MYVAR=SOMEVALUE
> >
> > $ echo $MYVAR> > SOMEVALUE
> >
> > Can make this works....
> >
> > Thanks!
> > _______________________________________________
> > Informix-list mailing list
> > Informix-list@iiug.org
> > http://www.iiug.org/mailman/listinfo/informix-list
>
>
>
> --
> Mike Aubury
>
> http://www.aubit.com/
> Aubit Computing Ltd is registered in England and Wales, Number: 3112827
> Registered Address : Clayton House,59 Piccadilly,Manchester,M1 2AQ
>
>
>
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
_________________________________________________________________
Color coding for safety: Windows Live Hotmail alerts you to suspicious email.
http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_safety_112008