[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Enable compgen even when programmable completions are not available?
From: |
Kerin Millar |
Subject: |
Re: Enable compgen even when programmable completions are not available? |
Date: |
Mon, 26 Jun 2023 10:58:53 +0100 |
On Mon, 26 Jun 2023 11:47:21 +0200
alex xmb ratchev <fxmbsw7@gmail.com> wrote:
> On Mon, Jun 26, 2023, 00:25 Eli Schwartz <eschwartz93@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
Re: Enable compgen even when programmable completions are not available?, Robert Elz, 2023/06/26
Re: Enable compgen even when programmable completions are not available?, alex xmb ratchev, 2023/06/26
- Re: Enable compgen even when programmable completions are not available?,
Kerin Millar <=
Re: Enable compgen even when programmable completions are not available?, Chet Ramey, 2023/06/29
Re: Enable compgen even when programmable completions are not available?, Robert Elz, 2023/06/30