Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

set -x and [[ xxxx = pattern ]]



Hiya,

$ zsh -xc '[[ a = * ]]'
+zsh:1> [[ a == '*' ]]
$ zsh -xc "[[ a = '*' ]]"
+zsh:1> [[ a == '*' ]]
$ zsh -xc '[[ a = "*" ]]'
+zsh:1> [[ a == '*' ]]

Shouldn't the output be different? (same goes for "case").

I'd expect the [[ x = * ]] to show [[ x == * ]]

bash and ksh seem to be doing better here:

~$ bash -xc '[[ a = * ]]'
+ [[ a = * ]]
~$ bash -xc '[[ a = *"*" ]]'
+ [[ a = *\* ]]
(1)~$ ksh -xc '[[ a = * ]]'
+ [[ a == * ]]
~$ ksh -xc '[[ a = *\* ]]'
+ [[ a == *\* ]]
~$ ksh -xc '[[ a = *"*" ]]'
+ [[ a == *\* ]]

~$ a='*' ksh -xc '[[ a = $a ]]'
+ [[ a == * ]]
~$ a='*' ksh -xc '[[ a = "$a" ]]'
+ [[ a == \* ]]
~$ a='*' bash -xc '[[ a = $a ]]'
+ [[ a = * ]]
~$ a='*' bash -xc '[[ a = "$a" ]]'
+ [[ a = \* ]]


-- 
Stéphane



Messages sorted by: Reverse Date, Date, Thread, Author