busybox/shell/hush_test/hush-vars/var_bash1b.tests
Denys Vlasenko e32b6503e7 hush: support ${VAR:N:-M}
function                                             old     new   delta
expand_one_var                                      1602    1615     +13
builtin_type                                         114     116      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-17 16:46:57 +02:00

25 lines
616 B
Plaintext
Executable File

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:$?