diff options
Diffstat (limited to 'shell/ash_test/ash-vars/var_bash2.tests')
-rwxr-xr-x | shell/ash_test/ash-vars/var_bash2.tests | 24 |
1 files changed, 24 insertions, 0 deletions
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} |