Both /bin/sh and /usr/local/bin/bash appear to correctly implement the
following forms of shell parameter expansion syntax, as required by POSIX
ISO/IEC 9945-2 & ANSI/IEEE Std 1003.3 (1993-12-22):
These forms are not however documented in the "Parameter Expansion"
sections of either the man page for sh or the man page for bash.
(I should perhaps be filing this PR as two separate PRs, one for sh
and one for bash, and will do so upon request. However my hope is
that whoever fixes one of the two relevant man pages will also have
the courtesy to fix the other as well.)
Note: The semantics of the two forms of parameter expansion syntax
mentioned above are helpfully and briefly described on the following web
The author of this PR will provide diffs/patches for the relevant man pages
upon request, however the fix in each case (sh and bash) should be both
trivial and obvious, I believe.
man 1 sh
man 1 bash
On Sat, Jan 04, 2014 at 07:45:19PM -0800, Ronald F.Guilmette wrote:
> These forms are not however documented in the "Parameter Expansion"
> sections of either the man page for sh or the man page for bash.
"In the parameter expansions shown previously, use of the colon in the
format results in a test for a parameter that is unset or null; omission
of the colon results in a test for a parameter that is only unset."
(c) sh(1) under "Parameter Expansion" section (also on web -> ).
WBR, Taras Korenko
As noted in comment 1, these expansion syntaxes are documented, albeit not in a very obvious fashion.
bash is not part of the FreeBSD base system; the manual page for bash is installed as part of the bash package,so issues with the bash manual page should be reported to the bash upstream.
I will think about whether there are ways to reword the sh manual page to make these syntaxes more clear.