On Tue, 5 Sep 2023 16:04:50 +0200 alex xmb ratchev <fxmb...@gmail.com> wrote:
> On Mon, Sep 4, 2023, 15:19 Kerin Millar <k...@plushkava.net> wrote: > > > On Mon, 4 Sep 2023 14:46:08 +0200 > > Léa Gris <lea.g...@noiraude.net> wrote: > > > > > Le 04/09/2023 à 14:18, Dan Jacobson écrivait : > > > > Shouldn't "declare -ax" print a warning that it is useless? > > > > > > There don's seem to be any warning system in Bash or other shells. As > > > long as it is not a fatal error condition and errexit is not set, > > > execution continue. > > > > > > There are static analysis tools like Shellcheck which might be expanded > > > to ware of such incompatible flags but that's it. > > > > Curiously, ARRAY_EXPORT can be defined in config-top.h. It's probably safe > > to say that nobody uses it (nor should anybody wish to upon realising how > > it works). > > > > does it make too big copies or wha .. My pet name for it is arrayshock. $ arr=(foo bar baz) $ export arr $ env | grep ^BASH_ARRAY_ BASH_ARRAY_arr%%=([0]="foo" [1]="bar" [2]="baz") $ ./bash -c 'declare -p arr' declare -ax arr=([0]="foo" [1]="bar" [2]="baz") It's not particularly reliable. The following is to be expected because the prospective environment ends up being too large. $ arr=({1..100000}); /bin/true bash: /bin/true: Argument list too long However, emptying the array does not remedy the situation (unsetting does). $ arr=(); /bin/true bash: /bin/true: Argument list too long -- Kerin Millar