Re: [PATCH] expand: Fix naked backslah leakage

Herbert Xu <[email protected]>
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
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 <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.