On 12/9/14, 9:47 AM, Stephane Chazelas wrote: > 2014-12-09 07:14:16 -0700, Eric Blake: > [...] >> No, you get the correct behavior. Newer bash fixed the parser bug to >> comply with POSIX. >> >> For comparison, try: >> >> $ echo . ${VAR:=""} . >> . . >> $ echo . "${VAR:=""}" . >> . . > [...] > > It's a bit confusing that ${VAR:-""} should be treated > differently from ${VAR:=""}. Was there a rationale for changing > the behaviour other than strict POSIX conformance? AFAICT, ksh > and mksh behave differently (from bash and from each other), so > I can't say the change helps much with portability here.
http://austingroupbugs.net/view.php?id=221 "Quote removal is performed when assigning the value in the ${parameter:=word} form of expansion in order that a subsequent expansion of the same parameter produces the same value as the original expansion. That is, the commands: unset parameter foo=${parameter:=word} bar=${parameter} assign the same value to foo and bar. A consequence of this is that the expansions ${parameter:=word} and ${parameter:-word} can produce different results for the same word." -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/