ash: support for && and || in [[ expr ]]; add testsuite checks
This commit is contained in:
2
shell/ash_test/ash-arith/arith-bash1.right
Normal file
2
shell/ash_test/ash-arith/arith-bash1.right
Normal file
@ -0,0 +1,2 @@
|
||||
1
|
||||
0
|
5
shell/ash_test/ash-arith/arith-bash1.tests
Executable file
5
shell/ash_test/ash-arith/arith-bash1.tests
Executable file
@ -0,0 +1,5 @@
|
||||
# checks for [[ ]]
|
||||
|
||||
# && and ||
|
||||
[[ a && "" ]]; echo $?
|
||||
[[ a || "" ]]; echo $?
|
14
shell/ash_test/ash-vars/var_bash1.right
Normal file
14
shell/ash_test/ash-vars/var_bash1.right
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
f
|
||||
bcdef
|
||||
abcdef
|
||||
abcdef
|
||||
bcde
|
||||
abcd
|
||||
abcd
|
||||
abcdef
|
||||
bcdef
|
||||
abcdef
|
||||
abcdef
|
||||
abcdef
|
18
shell/ash_test/ash-vars/var_bash1.tests
Executable file
18
shell/ash_test/ash-vars/var_bash1.tests
Executable file
@ -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}
|
10
shell/ash_test/ash-vars/var_bash2.right
Normal file
10
shell/ash_test/ash-vars/var_bash2.right
Normal file
@ -0,0 +1,10 @@
|
||||
abc123xcba123
|
||||
abx123dcba123
|
||||
abx123dxba123
|
||||
abcx23dcba123
|
||||
abcxxxdcbaxxx
|
||||
abx
|
||||
xba123
|
||||
abx23
|
||||
abc23dcba123
|
||||
abcdcba
|
24
shell/ash_test/ash-vars/var_bash2.tests
Executable file
24
shell/ash_test/ash-vars/var_bash2.tests
Executable file
@ -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}
|
Reference in New Issue
Block a user