Hello,

This concern:
https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion

In the bash documentation, section “shell parameter expansion,” in the
paragraph “${parameter:-word},” the example given uses
   ${parameter-word}
which is a Bourne Shell compatible expansion but behaves differently
for defined but empty parameters. For greater clarity, shouldn't we
write the following documentation (Please excuse the RST syntax):

``${parameter:-word}``
----------------------

If parameter is unset or null, the expansion of word is substituted.
Otherwise, the value of parameter is substituted.

::

   $ v=123
   $ echo ${v:-unset}
   123
   $ e=''
   $ echo ${e:-unset}
   unset
   $ echo ${u:-unset}
   unset

``${parameter-word}``
---------------------

If parameter is unset, the expansion of word is substituted. Otherwise,
the value of parameter is substituted.
This differs from ``${parameter:-word}`` in the case where
``parameter`` is set but not null.
This expansion comes from Bourne-Shell.

::

   $ v=123
   $ echo ${v:-unset}
   123
   $ e=''
   $ echo ${e:-unset}
   
   $ echo ${u:-unset}
   unset

P.-S. This is my first report to a GNU project. Please point out any
important best practices that I have not followed.
-- 
Alexis Reynouard <alexis.reynou...@gmail.com>

Reply via email to