2019-06-18 10:24:20 -0400, Chet Ramey:
> On 6/18/19 6:47 AM, Stephane Chazelas wrote:
> > 2019-06-18 11:27:18 +0100, Stephane Chazelas:
> > [...]
> >> A [12] and [13] to add to the list (though it could just be a
> >> bug in bash):
> > [...]
> > 
> > $ a='\/' bash5 -c 'printf "%s\n" $a'
> > \/
> 
> I haven't had time to go through all of this, but all the shells I see
> treat that as a pattern ending in an unescaped backslash, and produce
> the same results.
[...]

None of the other shells implement the bash5 behaviour whereby

$ a='\.' bash5 -c 'printf "%s\n" $a'
.

So they can't be compared there. Geoff says it's the required
behaviour, so I'm just pointing out that \/ would probably need
to be documented as an exception or change the wording to make
it clear that in that case that "\" is the last character of a
pattern.

All of kresh, dash, ksh93 and bash do output "yes" in:

$ a='\/' dash -c 'case / in $a) echo yes; esac'
yes

As POSIX seemingly requires even though most implementations
(including the traditional ones) don't do it and it's not
documented in any shell.

-- 
Stephane


Reply via email to