help-bash
[Top][All Lists]
Advanced

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

Re: Bash Shell Parameter Expansion


From: Greg Wooledge
Subject: Re: Bash Shell Parameter Expansion
Date: Sat, 9 Oct 2021 19:28:46 -0400

On Sun, Oct 10, 2021 at 01:09:12AM +0200, Alex fxmbsw7 Ratchev wrote:
> you may be not reading the man bash to your version ?
> 
> a means b
> - means str appears when var is unset ( never used yet )
> + means str appears when var is set already
> 
> :- means str if unset or empty
> :+ str if set or empty
> 
> .. hmm im not sure atm..

Many people skip this paragraph in the manual:

       When not performing substring expansion, using the forms documented be‐
       low (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 un‐
       set.

Once you know it's there, it's pretty easy to remember how to find it:
you search for "Parameter Expansion", and then for "colon".  Takes you
straight there.



reply via email to

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