Re: [PATCH] expand: Fix naked backslah leakage

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

 



On Sat, Apr 27, 2024 at 01:12:19PM +0100, Harald van Dijk wrote:
>
> The correct result here, I believe, is <\*bc>. The backslash means the next
> character is taken as literal, even if that character is already also taken
> as literal because of the quoting. There is nothing to cause the backslash
> to be taken literally. The result should be that only a leading * is removed
> from $a.

While I do see the logic in your reasoning, no other shell implements
this behaviour:

*sh -c 'a="*bc"; b="\\"; c="*"; echo "<${a##$b"$c"}>"'

always produces <*bc> across all shells on my system.

Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt




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

  Powered by Linux