Re: dash bug: double-quoted "\" breaks glob protection for next char

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 04, 2018 at 06:27:45PM +0200, Denys Vlasenko wrote:
>
> This does not match what happens with this simple heredoc:
> 
> cat <<EOF
> \"
> EOF
> 
> # dash zz
> \"

Right, the special double quote part only comes into play inside
backquotes.  The reason is that the parsing of backquotes is done
in two parts.  We first have to detect the end of the backquote
expansion.  While doing so we will remove any backslashes that
are deemed to be special.

Once we have the complete string it is then fed into the parser
again.  During this stage the backslash is already gone so the
double quote becomes an actual double quote rather than a literal
one.

This is how it works in ksh93 too.

If you want to have guarantee a literal backslash inside a here-
document then you should always do \\.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux