summaryrefslogtreecommitdiff
path: root/shell/ash_test
diff options
context:
space:
mode:
Diffstat (limited to 'shell/ash_test')
-rw-r--r--shell/ash_test/ash-arith/arith-bash1.right2
-rwxr-xr-xshell/ash_test/ash-arith/arith-bash1.tests5
-rw-r--r--shell/ash_test/ash-vars/var_bash1.right14
-rwxr-xr-xshell/ash_test/ash-vars/var_bash1.tests18
-rw-r--r--shell/ash_test/ash-vars/var_bash2.right10
-rwxr-xr-xshell/ash_test/ash-vars/var_bash2.tests24
6 files changed, 73 insertions, 0 deletions
diff --git a/shell/ash_test/ash-arith/arith-bash1.right b/shell/ash_test/ash-arith/arith-bash1.right
new file mode 100644
index 0000000..b261da1
--- /dev/null
+++ b/shell/ash_test/ash-arith/arith-bash1.right
@@ -0,0 +1,2 @@
+1
+0
diff --git a/shell/ash_test/ash-arith/arith-bash1.tests b/shell/ash_test/ash-arith/arith-bash1.tests
new file mode 100755
index 0000000..b37b730
--- /dev/null
+++ b/shell/ash_test/ash-arith/arith-bash1.tests
@@ -0,0 +1,5 @@
+# checks for [[ ]]
+
+# && and ||
+[[ a && "" ]]; echo $?
+[[ a || "" ]]; echo $?
diff --git a/shell/ash_test/ash-vars/var_bash1.right b/shell/ash_test/ash-vars/var_bash1.right
new file mode 100644
index 0000000..c0a0769
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_bash1.right
@@ -0,0 +1,14 @@
+
+
+f
+bcdef
+abcdef
+abcdef
+bcde
+abcd
+abcd
+abcdef
+bcdef
+abcdef
+abcdef
+abcdef
diff --git a/shell/ash_test/ash-vars/var_bash1.tests b/shell/ash_test/ash-vars/var_bash1.tests
new file mode 100755
index 0000000..24d3c9a
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_bash1.tests
@@ -0,0 +1,18 @@
+var=abcdef
+
+echo ${var:7}
+echo ${var:6}
+echo ${var:5}
+echo ${var:1}
+echo ${var:0}
+echo ${var:-1}
+
+echo ${var:1:4}
+echo ${var:0:4}
+echo ${var::4}
+echo ${var:-1:4}
+
+echo ${var:1:7}
+echo ${var:0:7}
+echo ${var::7}
+echo ${var:-1:7}
diff --git a/shell/ash_test/ash-vars/var_bash2.right b/shell/ash_test/ash-vars/var_bash2.right
new file mode 100644
index 0000000..acba5c6
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_bash2.right
@@ -0,0 +1,10 @@
+abc123xcba123
+abx123dcba123
+abx123dxba123
+abcx23dcba123
+abcxxxdcbaxxx
+abx
+xba123
+abx23
+abc23dcba123
+abcdcba
diff --git a/shell/ash_test/ash-vars/var_bash2.tests b/shell/ash_test/ash-vars/var_bash2.tests
new file mode 100755
index 0000000..29c526c
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_bash2.tests
@@ -0,0 +1,24 @@
+var=abc123dcba123
+
+echo ${var/d/x}
+echo ${var/c/x}
+echo ${var//c/x}
+echo ${var/[123]/x}
+echo ${var//[123]/x}
+echo ${var/c*/x}
+echo ${var/*c/x}
+
+# must match longest match: result is "abx23"
+echo ${var/c*1/x}
+
+# empty replacement - 2nd slash can be omitted
+echo ${var/[123]}
+echo ${var//[123]}
+
+### ash doesn't support
+### # match only at the beginning:
+### echo ${var/#a/x}
+### echo ${var/#b/x} # should not match
+### echo ${var//#b/x} # should not match
+### # match only at the end:
+### echo ${var/%3/x}