Le mar. 3 mars 2026 à 02:15, Martin D Kealey <[email protected]> a écrit :
>
> I suggest that the preface text be removed, and the four following paragraphs
> be amended to read something like:
>
> ${parameter-word} or ${parameter:-word}
> Use Default Values.
> If parameter is unset (or set but null, if the colon is included), the
> expansion of word is substituted. Otherwise, the value of parameter is
> substituted.
> ${parameter=word} or ${parameter:=word}
> Assign Default Values.
> If parameter is unset (or set but null, if the colon is included), the
> expansion of word is assigned to parameter. The value of parameter is then
> substituted. Positional parameters and special parameters may not be assigned
> to in this way.
> ${parameter?word} or ${parameter:?word}
> Display Error if Null or Unset.
> If parameter is unset (or set but null, if the colon is included), the
> expansion of word (or a message to that effect if word is not present) is
> written to the standard error and the shell, if it is not interactive, exits.
> Otherwise, the value of parameter is substituted.
> ${parameter+word} or ${parameter:+word}
> Use Replacement Value.
> If parameter is unset (or set but null, if the colon is included), nothing is
> substituted, otherwise the expansion of word is substituted.
>
> Alternatively, remove the preamble paragraph and add this paragraph as the
> 5th entry in the list:
>
> ${parameter-word}
> ${parameter=word}
> ${parameter?word}
> ${parameter+word}
> These function the same as the corresponding colon variants, except that they
> check only for the parameter being unset; being set but null is treated the
> same as being set to any other value.
>
> -Martin
>
> PS: Whilst the English meaning of “null” can be “empty”, in computing it's
> commonly used to mean “absence of an object” as distinct from “empty object”,
> so I would avoid, but I would leave that as a change for another day.
I also think such a wording would be clearer.
Best regards,
Laurent