Stephane Chazelas <stephane.chaze...@gmail.com> wrote: > 2018-04-17 16:24:09 +0200, Joerg Schilling: > [...] > > > This behaviour is, frankly, utterly broken and I'm astonished that > > > any shell author would think it was a good idea. > > > > In your specific example, it looks incorrect. In many other cases, it seems > > to > > be helpful. > [...] > > Can you please give an example where it could be useful?
e.g. in all cases where the string you are looking for is a "bad pattern". > IMO, it should be (remain) treated as a bug/misdesign of > Bourne/ksh88. Since I am sure that the implementation is exactly the way it is by intention (We may try to ask Stepehn Bourne ;-) but he did not work on the shell since at least 35 years. I believe it is to make looking for "bad pattern" easier. > Note that, as I said earlier ksh (88 and 93) doesn't do it for > [[ string = pattern ]], so presumably, it only does it for > backward portability with the Bourne shell (it's even possible > David Korn hadn't realised the Bourne shell was doing that and > just inherited the code). But this is not part of POSIX. Maybe this is a question to ask David Korn for. > > If you do not like to make existing behavior of the reference > > implementations > > incorrect, there needs to be a better solution for the problem you mention. > > To work around that bug/misfeature, one would have to do: > > > case $answer in > "[0-9]") echo KO;; > [0-9]) echo OK;; > *) echo KO;; > esac So, thank you. There is a way to deal with this kind of behavior. Jörg -- EMail:jo...@schily.net (home) Jörg Schilling D-13353 Berlin joerg.schill...@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'