summaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-test2/strops1.tests
diff options
context:
space:
mode:
authorDenys Vlasenko2020-10-31 03:34:07 +0100
committerDenys Vlasenko2020-10-31 03:34:07 +0100
commitd2241f59022c38d4b171e56eea42e216ecccfdd9 (patch)
treeedb75c2530f493c9e3f193f346d8125fe79c107f /shell/hush_test/hush-test2/strops1.tests
parent112453acf24520b4655f9f36da41d8ac591b1a60 (diff)
downloadbusybox-d2241f59022c38d4b171e56eea42e216ecccfdd9.zip
busybox-d2241f59022c38d4b171e56eea42e216ecccfdd9.tar.gz
shell: better support of [[ ]] bashism
Still rather rudimentary for ash function old new delta binop 433 589 +156 check_operator 65 101 +36 done_word 736 769 +33 test_main 405 418 +13 parse_stream 2227 2238 +11 ops_texts 124 133 +9 ops_table 80 86 +6 run_pipe 1557 1562 +5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/0 up/down: 269/0) Total: 269 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test/hush-test2/strops1.tests')
-rwxr-xr-xshell/hush_test/hush-test2/strops1.tests15
1 files changed, 15 insertions, 0 deletions
diff --git a/shell/hush_test/hush-test2/strops1.tests b/shell/hush_test/hush-test2/strops1.tests
new file mode 100755
index 0000000..bb24e2a
--- /dev/null
+++ b/shell/hush_test/hush-test2/strops1.tests
@@ -0,0 +1,15 @@
+v='*.z'
+[[ a.z = *.z ]]; echo 1:YES:$?
+[[ a.z == $v ]]; echo 2:YES:$?
+
+# wildcards can match a slash
+[[ a/b = a*b ]]; echo 3:YES:$?
+[[ a/b == a?b ]]; echo 4:YES:$?
+
+# wildcards can match a leading dot
+[[ a/.b = a/*b ]]; echo 5:YES:$?
+[[ a/.b == a/?b ]]; echo 6:YES:$?
+
+# wildcards can be escaped
+[[ abc = a*c ]]; echo 7:YES:$?
+[[ abc == a\*c ]]; echo 8:no:$?