summaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-vars/var_bash1b.tests
diff options
context:
space:
mode:
authorDenys Vlasenko2017-07-17 17:49:11 +0200
committerDenys Vlasenko2017-07-17 17:49:11 +0200
commit826360ff238eb23191950dd4c5051195eab9733a (patch)
treed9dbd7da77e985e181af0b8ad406d467379b498b /shell/ash_test/ash-vars/var_bash1b.tests
parent4f8079de877cf2b7206e4cabaf465fb7d8cc4f62 (diff)
downloadbusybox-826360ff238eb23191950dd4c5051195eab9733a.zip
busybox-826360ff238eb23191950dd4c5051195eab9733a.tar.gz
ash: more general format ${var:EXPR:EXPR}
function old new delta subevalvar 1171 1202 +31 localcmd 364 366 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test/ash-vars/var_bash1b.tests')
-rwxr-xr-xshell/ash_test/ash-vars/var_bash1b.tests24
1 files changed, 24 insertions, 0 deletions
diff --git a/shell/ash_test/ash-vars/var_bash1b.tests b/shell/ash_test/ash-vars/var_bash1b.tests
new file mode 100755
index 0000000..efbdef3
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_bash1b.tests
@@ -0,0 +1,24 @@
+set -- 0123456
+ echo "all |"$1
+ echo "4: |"${1:4}
+ echo "4:2 |"${1:4:2}
+ echo "4:-1 |"${1:4:-1}
+ echo "4:-2 |"${1:4:-2}
+ echo "4:-3 |"${1:4:-3}
+ echo "-4: |"${1: -4}
+ echo "-4:2 |"${1: -4:2}
+ echo "-4:-1 |"${1: -4:-1}
+ echo "-4:-2 |"${1: -4:-2}
+ echo "-4:-3 |"${1: -4:-3}
+ echo "-4:-4 |"${1: -4:-4}
+i=2; echo "-4:i=2 |"${1: -4:i}
+i=-2; echo "-4:i=-2|"${1: -4:i}
+i=-3; echo "-4:i=-3|"${1: -4:i}
+i=-4; echo "-4:i=-4|"${1: -4:i}
+ echo "-5: |"${1: -5}
+ echo "-6: |"${1: -6}
+ echo "-7: |"${1: -7}
+ echo "-8: |"${1: -8}
+ echo "-9: |"${1: -9}
+ echo "-9:-99 |"${1: -9:-99}
+echo Ok:$?