Denys Vlasenko | 64981b4 | 2020-11-01 18:47:24 +0100 | [diff] [blame] | 1 | v='*.z' |
| 2 | [[ a.z = *.z ]]; echo 1:YES:$? |
| 3 | [[ a.z = "*".z ]]; echo 2:no:$? |
| 4 | [[ a.z == $v ]]; echo 3:YES:$? |
| 5 | |
| 6 | # Buggy: |
| 7 | # the problem is that expansion rules of LHS and RHS of ~= |
| 8 | # should not be the same: in RHS, "$v" and "*" should escape metas |
| 9 | # (currently "$v" does not), |
| 10 | # but in LHS, they should _not_ do that |
| 11 | # (currently "*" does). Thus these cases fail: |
| 12 | #[[ a.z == "$v" ]]; echo 4:no:$? # BUG: "$v" expands to *.z |
| 13 | #[[ "*".z == ?.z ]]; echo 5:YES:$? # BUG: "*" expands to \* |