Re: [Help-bash] Why does foo=bar compgen -e not show foo as a name?
From:
David Margerison
Subject:
Re: [Help-bash] Why does foo=bar compgen -e not show foo as a name?
Date:
Sun, 29 Apr 2018 16:43:02 +1000
On 29 April 2018 at 15:58, Nick Chambers <address@hidden> wrote:
> Using bash 4.4, I am able to replicate this on both macos High Sierra
> and Ubuntu 17.10. Why does the following not show foo as an
> environment variable?
>
> ubuntu:~ nchambers$ clear
> ubuntu:~ nchambers$ foo=bar compgen -e
$ type compgen
compgen is a shell builtin
so new no process is started, so compgen sees the same environment
as the shell.
Refer man bash COMMAND EXECUTION ENVIRONMENT which says
"When a simple command _other_than_a_builtin_ or shell function is to be
executed, it is invoked in a separate execution environment".