bug-bash
[Top][All Lists]
Advanced

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

Re: Enable compgen even when programmable completions are not available?


From: Robert Elz
Subject: Re: Enable compgen even when programmable completions are not available?
Date: Sat, 01 Jul 2023 02:25:33 +0700

    Date:        Fri, 30 Jun 2023 18:35:34 +0100
    From:        Kerin Millar <kfm@plushkava.net>
    Message-ID:  <20230630183534.85da7986a24855126bfeab27@plushkava.net>

  | This can be trivially foiled.

You mean it doesn't give you all the variable names?   Why not?
Does bash have a bug in this area that I am unaware of?

Or do you mean that it will sometimes (due to newlines in the values)
be able to be persuaded to give you more than just the var names?

If the latter, why do you care?  The processing can check for each variable
name produced whether it is set or not, and simply skip anything that looks
like it is a variable name, but actually isn't set in the shell.  If it is
important that each var name be included just once, just run the output
through sort -u so any duplicates (which will only be caused by that kind
of newline in the value stuff) get removed.

You're going to need a more sophisticated sed script (but not all that
much more) to remove any "obviously not a variable name followed by ="
lines, but you should be getting all of the variable names, which is the
part that really matters, I am guessing.  That is, making sure none are
missing is the challenging part, weeding out fakes is simple.

kre




reply via email to

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