From: Junio C Hamano Date: Mon, 05 Sep 2011 07:45:53 GMT Subject: Re: [PATCH] shell portability: Use sed instead of non-portable variable expansion Message-ID: <7v39gbxwi6.fsf@alter.siamese.dyndns.org> In-Reply-To: <4E647BD5.8060609@viscovery.net> Johannes Sixt writes: > Actually, it's the opposite: Within double-quotes, a backslash is only > removed when the next character has a special meaning (essentially $, `, > ", \), otherwise, it remains and loses its quoting ability. This means, > that the backslash would remain as a literal character in our patterns on > the right of % or #, and they would not work anymore as intended. That's strange... I thought that VAR= would behave identically to VAR="". You seem to be saying that they should act differently. >> If that is the case, either the above or my [?] would work it around, I >> would think. > > [?] instead of \? is certainly also worth a try. I obviously agree. Besides, [?] would sidestep the tricky backslash vs double quote issue entirely, so it would be a more robust solution to leave it around than "sometimes you need to avoid double-quote and some other times you would need double-quote" for other people to mimic writing tests later.