bug-bash
[Top][All Lists]
Advanced

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

Re: Typo in Bash Reference Manual


From: Greg Wooledge
Subject: Re: Typo in Bash Reference Manual
Date: Wed, 25 Jun 2025 14:00:11 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Wed, Jun 25, 2025 at 17:47:31 +0000, Wartik, Steven P "Steve" via Bug 
reports for the GNU Bourne Again SHell wrote:
> After many years of staring at the Bash Reference Manual, I just noticed a 
> typo in Section 3.5.3 (Shell Parameter Expansion):
> 
> [cid:image003.jpg@01DBE5D7.B1DBC120]
> 
> The parameter in the echo command is missing a colon. It should be:
> 
> $ echo ${v:-unset}

Both of those are valid syntax, and they have *slightly* different
meanings.

${v-unset} expands to the value of "v" if it has any value assigned,
otherwise the literal string "unset".

${v:-unset} expands to the value of "v" if it has any value assigned
other than the empty string, otherwise the literal string "unset".

When performing a test of whether a variable is defined or undefined,
you want the no-colon form ${var-x}.  Presumably that's what the
example is doing, so the example is correct.



reply via email to

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