Re: ${parameter+word} not documented in bash.info or bash(1)

2009-01-10 Thread Martin Schwenke
 Bob == Bob Proulx b...@proulx.com writes:

Bob [...] Let me suggest that something similar to the following
Bob addition would help here.

Bob   is unset or null; omitting the colon (':') results in a
Bob   test only for a parameter that is unset.

Bob Then searches on : would also find that descriptive text
Bob too.

I agree.

However, I would still suggest going further and including at least
one full example.

peace  happiness,
martin





Re: ${parameter+word} not documented in bash.info or bash(1)

2009-01-09 Thread Martin Schwenke
 Paul == Paul Jarc p...@po.cwru.edu writes:

Paul Martin Schwenke mar...@meltin.net wrote:

 Neither bash.info or bash(1) documents parameter expansion of
 the form:
 
 ${parameter+word}

Paul It's documented, but it's easy to miss.  Just before the
Paul list of parameter expansion forms is this paragraph:

PaulIn each of the cases below, word is subject to tilde
Paulexpansion, parameter expansion, command substitution,
Pauland arithmetic expansion.  When not performing
Paulsubstring expansion, bash tests for a parameter that
Paulis unset or null; omitting the colon results in a
Paultest only for a parameter that is unset.

Ouch!  Can I suggest that this documentation could be improved, since
it is so easy to miss and that I missed it at least 4 times when
actually looking for it?  ;-)

I think the main issue is that when people use reference documentation
they tend to scan through it to find what they're looking for.

My suggestion would be to break the list of expansions before
substring expansion and insert a paragraph containing the above text.
Then, rather than necessarily listing all of the examples as the
standard does, perhaps provide a single example that compares the
effect of using the colon with the effect of excluding it.

The bash documentation is so long that I don't think adding this will
make it too long...  :-)

peace  happiness,
martin





Re: ${parameter+word} not documented in bash.info or bash(1)

2009-01-09 Thread Bob Proulx
Martin Schwenke wrote:
 Paul Jarc writes:
  It's documented, but it's easy to miss.  Just before the
  list of parameter expansion forms is this paragraph:
 
 In each of the cases below, word is subject to tilde
 expansion, parameter expansion, command substitution,
 and arithmetic expansion.  When not performing
 substring expansion, bash tests for a parameter that
 is unset or null; omitting the colon results in a
 test only for a parameter that is unset.
 
 Ouch!  Can I suggest that this documentation could be improved, since
 it is so easy to miss and that I missed it at least 4 times when
 actually looking for it?  ;-)

Let me cast a vote for this too.  I know what it does but have also
found myself looking for it specifically because I am looking for
: and not colon.  If the colon character ':' were mentioned in the
description I think that would make this much clearer.  Let me suggest
that something similar to the following addition would help here.

  is unset or null; omitting the colon (':') results in a
  test only for a parameter that is unset.

Then searches on : would also find that descriptive text too.

Bob




Re: ${parameter+word} not documented in bash.info or bash(1)

2009-01-08 Thread Paul Jarc
Martin Schwenke mar...@meltin.net wrote:
 Neither bash.info or bash(1) documents parameter expansion of the
 form:

   ${parameter+word}

It's documented, but it's easy to miss.  Just before the list of
parameter expansion forms is this paragraph:

   In each of the cases below, word is subject to tilde expansion,
   parameter expansion, command substitution, and arithmetic
   expansion.  When not performing substring expansion, bash tests
   for a parameter that is unset or null; omitting the colon
   results in a test only for a parameter that is unset.


paul




Re: ${parameter+word} not documented in bash.info or bash(1)

2009-01-08 Thread Chet Ramey
Martin Schwenke wrote:
 I'm running bash 3.2.39(1)-release (under Ubuntu 8.04 (Hardy)
 GNU/Linux).  Neither bash.info or bash(1) documents parameter
 expansion of the form:
 
   ${parameter+word}
 
 This is different to ${parameter:+word}, is clearly implemented by
 bash and is documented in the standard (The Open Group Base
 Specifications Issue 6, IEEE Std 1003.1, 2004 Edition).
 
 This may be useful:
 
   
 http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02

The bash documentation includes essentially the same text as the standard
describing the effect of omitting the colon in those word expansions.

 Thanks for bash, it rocks...  :-)

:-)

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/