help-bash
[Top][All Lists]
Advanced

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

Re: Is ${x+word} documented?


From: Daniel Mills
Subject: Re: Is ${x+word} documented?
Date: Sun, 31 Jan 2021 01:21:59 -0500

On Sun, Jan 31, 2021 at 1:14 AM Peng Yu <pengyu.ut@gmail.com> wrote:

> Hi,
>
> I don't find the usage of `${x+word}` documented in the manpage (in
> the Parameter Expansion section). Do I miss something here?
>
> Can I always assume ${x:+word} and ${x+word} are exactly the same?
>
> $ x=1
> $ echo ${x:+word}
> word
> $ echo ${x+word}
> word
>
> --
> Regards,
> Peng
>
>
Prom the man page:

 When not performing substring expansion, using the  forms  documented
 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.


reply via email to

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