bug-bash
[Top][All Lists]
Advanced

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

Re: declare -x non-exportable variable types


From: Alex fxmbsw7 Ratchev
Subject: Re: declare -x non-exportable variable types
Date: Fri, 25 Feb 2022 21:35:09 +0100

On Fri, Feb 25, 2022 at 8:52 PM Chet Ramey <chet.ramey@case.edu> wrote:

> On 2/25/22 12:55 PM, Léa Gris wrote:
> > Le 25/02/2022 à 16:49, Chet Ramey écrivait :
> >
> >> You can't export array variables, period. You can't export attributes,
> >> only variable names and values. You still can't export attributes.
> There
> >> is no way to export attributes
> >
> > Chet, I heard you, I understood it and I knew it before, while I was
> > writing my message, and still now.
> >
> > It feels like that you were either in a bad mood or that I didn't manage
> to
> > express my remarks and thoughts as clearly as I would have liked.
>
> OK. I don't think my response was especially tense (now, terse, maybe). I
> simply disagree with much of your premise.
>
> > Now that you and I are, were and still are (I reassure you) in absolute
> > agreement with: "Bash variable attributes and, or arrays are
> incompatible
> > with environment variables" (undisputed fact)...
>
> Variables have names, values, and attributes. Environment variables don't
> have enough information to contain all three (or two, in the case of
> arrays, without some special encoding).
>

you map those as extension in free space, just like you do with your
function to children passment
my only comment to this


> >
> > Is it possible that: if these variables are passed explicitly as
> > environment variables with -x or export :
> >
> > - Either Bash returns an error because of "variable flags are
> incompatible
> > with the environment, and it's a mistake to export Bash variables with
> > flags", rather than having different behaviours (pass value, nothing,
> > name...) based on the original Bash variable flags/type?
>
> But you have not shown such `different behaviors'. In the case of array
> variables, not exporting them is a conscious choice based on the issues
> encoding the values, and that is documented. Is that what you mean?
>
> >
> > - Or that Bash should now be able to "convert" the value as it does now,
> > but in a more consistent way?
>
> I simply don't see the inconsistency you claim is there. Bash exports names
> and values for variables to which you assign the export attribute.
>
> > - Or that the documentation contains an explicit description of what
> > happens when one tries to export a Bash variable with flags/types (even
> > just documented as: "The result of exporting Bash variables with
> attributes
> > is indeterminate"), which might be an appropriate clarification?
>
> OK, what's indeterminate about it? I showed how the behavior from your
> first message was all consistent.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/
>
>


reply via email to

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