[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Antw: [EXT] Re: manual page missing ${parameter-replacement}
From: |
Ulrich Windl |
Subject: |
Antw: [EXT] Re: manual page missing ${parameter-replacement} |
Date: |
Mon, 21 Nov 2022 10:38:02 +0100 |
Sorry, I actually miussed it, as the typical usage pattern for lengthy manual
pages is like searching for ":-" and looking what is standing there:
${parameter:-word}
Use Default Values. If parameter is unset or null, the
expan-
sion of word is substituted. Otherwise, the value of
parameter
is substituted.
I see that there is some text before describing the first substitution pattern
common to all the ':' substitutions.
But from the syntax "${parameter:-word}" it's not really obvious that the
colon may be omitted.
Should it be "${parameter[:]-word}" (with non-bold square brackets) instead
(as for "name=[value]")?
Despite of that only ":-" is typeset in bold; shouldn't "${" and "}" be
typeset in bold, too?
>>> Lawrence Velázquez <vq@larryv.me> schrieb am 21.11.2022 um 08:49 in
Nachricht
<99ac660c-3f76-4461-92b6-605c27c022c8@app.fastmail.com>:
> On Mon, Nov 21, 2022, at 2:20 AM, Ulrich Windl wrote:
>> I think the bash manual page lacks some important detail of parameter
>> substitution, namely:
>> "Bash tests for a parameter that is unset or null. Omitting the colon
>> results in a test only for a parameter that is unset."
>>
>> (found in
>>
>
https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.
> html)
>
> You omitted all of the relevant context. The full paragraph is:
>
> When not performing substring expansion, using the form [sic]
> described below (e.g., ':-'), Bash tests for a parameter
> that is unset or null. Omitting the colon results in a
> test only for a parameter that is unset. Put another way,
> if the colon is included, the operator tests for both
> _parameter_'s existence and that its value is not null; if
> the colon is omitted, the operator tests only for existence.
>
> The manual then goes on to describe the ${parameter:-word},
> ${parameter:=word}, ${parameter:?word}, and ${parameter:+word}
> forms. These are what your excerpt is talking about.
>
> So what do you think is missing, exactly?
>
> --
> vq