Am 5/9/2011 6:40, schrieb Junio C Hamano: > Johannes Sixt <j.sixt@xxxxxxxxxxxxx> writes: > >> - The behavior of quoting at the right of :- when the ${...:-...} exansion >> appears in double-quotes was debated recently at length at the Austin >> group (which revises the POSIX standard). You better move the expansions >> to assignments of temporary variables,... > > What alternative semantics do Austin folks have in mind, by the way? Just > declare this undefined? Most of the debate centered around how to quote a closing brace: the problem is that usually the backslash within double-quotes is only special when followed by $, `, or \, therefore, it should not be possible to quote a closing brace using \}. It turned out that different shells handled this particular case differently. IIRC, there were also discrepancies whether whitespace generated on the RHS of :- (or other operators) was retained or discarded. The conclusion for us as application developers is not to depend on too many subtle details in such a variable expansions because the specification is too vague, shells implement it differently, and some even get it outright wrong (as the case discovered by Kascper). > - printf "fatal: Path '$2$3' $4, but not ${5:-'$3'}.\n" >expected && > - printf "Did you mean '$1:$2$3'${2:+ aka '$1:./$3'}?\n" >>expected && > + sq="'" This cuts the && chain. > + cat >expected <<-EOF && > + fatal: Path '$2$3' $4, but not ${5:-$sq$3$sq}. > + Did you mean '$1:$2$3'${2:+ aka $sq$1:./$3$sq}? > + EOF Looks good otherwise; I tested this with various shells, and there were no surprises. -- Hannes -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html