Subject: Re: [ast-users] Interpretation of escapes in expansions in pattern  
matching contexts
--------

> I couldn't find anything obvious in POSIX that implies which interpretation is
> correct. Assuming it's unspecified.
> 
> Bash (4.2.45) uniquely does interpret such escapes for [[, which makes me 
> think this test should say "no":
> 
>     x=\\x; if [[ x == $x ]]; then echo yes; else echo no; fi
> 
> bash: yes
> ksh:  no
> mksh: no
> zsh:  no
I think that 'no' is correct.
> 
> However, ksh93 (AJM 93v- 2013-03-17) is unique in that it flips the result
> depending on "[[ ]]" or "case..esac" (bug?), but otherwise it looks like a
> fairly random spread:
> 
>     x=\\x; case x in $x) echo yes;; *) echo no; esac
> 
> bash: yes
> ksh:  yes
> mksh: no
> posh: no
> zsh:  no
> dash: yes
> bb:   no
> jsh:  no
I think that 'no' is correct and that ksh93 is wrong.  ksh88 was correct.
I will fix this in the next alpha.
> 
> 18:42:44 jilles: ormaaj, I'm not sure if that's actually a bug
> 18:43:15 ormaaj: dunno. Bash seems unique in that respect
> 18:43:23 jilles: you're asking the shell to check if the string x matches the 
> pattern stored in the variable x
> 19:32:51 jilles: freebsd sh and kmk_ash say no, dash says yes
> 19:33:40 jilles: Bourne shell says no
> 
> -- 
> Dan Douglas

David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to