busybox/shell/hush_test/hush-test2/strops5.tests
Denys Vlasenko 64981b4c8e hush: document bugs in [[ =~ ]] comparison
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-01 18:47:24 +01:00

14 lines
474 B
Plaintext
Executable File

v='*.z'
[[ a.z = *.z ]]; echo 1:YES:$?
[[ a.z = "*".z ]]; echo 2:no:$?
[[ a.z == $v ]]; echo 3:YES:$?
# Buggy:
# the problem is that expansion rules of LHS and RHS of ~=
# should not be the same: in RHS, "$v" and "*" should escape metas
# (currently "$v" does not),
# but in LHS, they should _not_ do that
# (currently "*" does). Thus these cases fail:
#[[ a.z == "$v" ]]; echo 4:no:$? # BUG: "$v" expands to *.z
#[[ "*".z == ?.z ]]; echo 5:YES:$? # BUG: "*" expands to \*