On Mon, 12 Mar 2018 16:55:09 -0500, Kirk Wolf wrote:
>
>This is kind of a hack, but you could spawn /bin/env with no arguments and
>redirect the output to an anonymous pipe and then read that into a buffer.
>The output with be  a repeated stream of "KEY=VALUE\n"
> 
But be careful.  If a programmer has been mischievous enough to do such as:
    wombat="xyzzy
    foo=bar" export wombat

env will show:
    ...
    wombat=xyzzy
    foo=bar
    ....

Better:
    sh -c "export -p"
    ...
    export wombat='xyzzy
    foo=bar'
    ...
which is parseable.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to