Subject: re: bin/15579: /bin/sh parsing of complex ${variable:-word} sbstitutions
To: None <gnats-bugs@gnats.netbsd.org>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 08/12/2003 17:44:10
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.

The example ${foo:-"'{}'"} is actually processed correctly by the current
netbsd /bin/sh.

However I'm not certain about all the other possible constructs!

It does say that a portable script should use shell variables to
avoid any possible ambiguity. eg:
    squote=\' dquote=\" lbrace='{' rbrace='}'
    ${foo-$squote$rbrace$squote}
rather than:
    ${foo-"'}'"}

Maybe we shold close this...

	David

-- 
David Laight: david@l8s.co.uk