bug-bash
[Top][All Lists]
Advanced

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

Re: Mishandled backslashes in patternvar in ${var#...$patternvar...} ?


From: Robert Elz
Subject: Re: Mishandled backslashes in patternvar in ${var#...$patternvar...} ?
Date: Sat, 9 Aug 2025 14:54:00 +0700 (+07)

And one last correction to my own message (I promise, this is the last
of my messages for now!!!):

I failed to look at this case:

  | echo '${a##$b"$c"} removes \*:        '"|${a##$b"$c"}|"' - matches \, then 
*'       # bash prints |\*bc|

and just lumped it in with the other three - but this is actually another
example of the original ("dash change") case, and is unspecified, as
the \ that results from $b has nothing to escape, and hence produses
unspecified results, so whatever a shell produces for this one is OK.

The \ could be treated as a literal, as you expect, or it can be treated
as an error (which the NetBSD shell does, so the pattern matches nothing)
or it could just be ignored completely, leaving just "$c" to attempt to
match.  All up to the shell implementor.   GIGO again.

kre




reply via email to

[Prev in Thread] Current Thread [Next in Thread]