Subject: Re: bin/15579: /bin/sh parsing of complex ${variable:-word} sbstitutions
To: David Laight <david@l8s.co.uk>
From: Alan Barrett <apb@cequrux.com>
List: netbsd-bugs
Date: 08/13/2003 13:43:15
On Tue, 12 Aug 2003, David Laight wrote:
> The Posix spec:
> http://www.opengroup.org/onlinepubs/007904975/xrat/xcu_chap02.html
> notes that:
> It would be desirable to include the statement "The characters from an
> enclosed "${" to the matching '}' shall not be affected by the double
> quotes", similar to the one for "$()" . However, historical practice in
> the System V shell prevents this.
Interesting. I have always interpreted the use of the term "word"
in the sh(1) man page description of "${parameter:-word}", read in
conjunction with the definition of "word" elsewhere in the same
man page, as implying that stuff between the ":-" and the "}" was
recursively parsed as if it had appeared at the top level.
> Maybe we shold close this...
Yes, the problem was fixed soon after I raised the PR. See
src/regress/bin/sh/varquote.sh for test cases.
--apb (Alan Barrett)