Re: set environment variable



Hi, thanks i do that, anyway the wole process is for set envirnment
variables before an user runs his 4gl menu of programs.

In other program that doenst have ui, i just DISPLAY several
MYVAR=123; export MYVAR
then i call it from a shell:

fglgo my4gl >> /tmp/mktempfile
source /tmp/mktempfile
rm /tmp/mktempfile

But now i need to show a options menu so DISPLAY to console cant help
me :)

thanks again!


On 21 nov, 12:16, Mike Aubury <i...@xxxxxxxxx> wrote:
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-l...@xxxxxxxx
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

.



Relevant Pages

  • Re: set environment variable
    ... You're testing for having set something in the environment from a process ... to 'source' the settings so they are read into the current settings. ... You should be able to set the environment variables for use within the 4gl ...
    (comp.databases.informix)
  • Re: Windows disables write-cacheing on boot drive
    ... and having the write-cache settings reset upon each reboot. ... > available in the environment, ... .reg file to run as a startup file or set that entry in a GPO as a registry ...
    (microsoft.public.win2000.dns)
  • Windows XP Service Pack 2
    ... WAN 9000 times. ... and have noticed that in my environment, Windows 2000 AD 2000 that many GPO ... settings made have no effect. ... environment, and protecting the users from themselves, as well as helping me ...
    (microsoft.public.windowsxp.security_admin)
  • Re: allowing an @ sybol in a password
    ... It appears that you have teletype settings. ... characters were just ordinary printing characters, ... will use your current environment. ...
    (comp.unix.admin)
  • Re: Startup default language in VS 8 Pro
    ... Tools> Import and Export Settings> Reset All Settings ... environment, from the original choice made,without success. ... can program in any of the languages whatever the choice of language ... default, save the new one, and then use that process to allow selecting ...
    (microsoft.public.vstudio.general)