[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fwd: passing variables from awk-parent to bash-child]

From: Andrew J. Schorr
Subject: Re: [Fwd: passing variables from awk-parent to bash-child]
Date: Thu, 5 Oct 2006 16:47:17 -0400
User-agent: Mutt/

On Thu, Oct 05, 2006 at 11:52:30AM +0100, V. Mark Lehky wrote:
> I suspect I might have found an "issue", unfortunately I do not know if it 
> is in the program or documentation. :)
> Below is what I have posted to Usenet. I also tried to modify the below 
> program to "print MY_VAR=different_value2; my_echo" into a pipe "/bin/sh", 
> as is suggested in the manual section which describes the command 'system'.
> Nobody replied to this on Usenet, so I am turning to you in hopes of 
> getting somewhere.

As currently implemented, the gawk ENVIRON array does not support
your desired behavior.  To quote from gawk.info:

     An associative array that contains the values of the environment.
     The array indices are the environment variable names; the elements
     are the values of the particular environment variables.  For
     example, `ENVIRON["HOME"]' might be `/home/arnold'.  Changing this
     array does not affect the environment passed on to any programs
     that `awk' may spawn via redirection or the `system' function.

Note the last sentence.  So gawk is working as documented.  To achieve your
desired behavior would require patching gawk to use putenv or setenv to
manipulate the environment whenever ENVIRON is changed (or just before forking
a child process).  If you develop such a patch, I imagine there may be some
interest in it...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]