On Mon, 26 Jun 2023 11:47:21 +0200
alex xmb ratchev <fxmb...@gmail.com> wrote:

> On Mon, Jun 26, 2023, 00:25 Eli Schwartz <eschwart...@gmail.com> wrote:
> 
> > compgen is a useful builtin for inspecting information about the shell
> > context e.g. in scripts -- a good example of this is compgen -A function
> > or compgen -A variable.
> >
> > But it's not always available depending on how bash is built, which
> > results in people lacking confidence that it can / should be used in
> > scripts. See e.g. https://bugs.gentoo.org/909148
> 
> 
> i read kerin s try to parse declare -p
> 
> for me it works ..
> 
> bash-5.2$ { FOO=$'\nBAR BAZ QUUX='; declare -p; } |
> while IFS=' =' read -r _ _ name _; do printf '%s\n' "$name"; done |
> grep QUUX
> bash-5.2$ echo $?
> 1
> bash-5.2$

Yes. That's because you're using 5.2, which improves the quoting strategy for 
declare/typeset. Unfortunately, it's not something that I can rely upon in 
production (not least, because I can't yet assume that everyone is using bash 
>=5.2).


-- 
Kerin Millar

Reply via email to