diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2010-11-18 10:07:55 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2010-11-18 10:07:55 +0000 |
commit | 23bdfc7fd2a012d5205ed22d18eb39e41c8fbc95 (patch) | |
tree | 80d7f0e6c868a1283f3275cf88e08b8c86d509c1 /Test | |
parent | 851b8e151004ec729dad9c8c7867bbf67649df8e (diff) | |
download | zsh-23bdfc7fd2a012d5205ed22d18eb39e41c8fbc95.tar.gz zsh-23bdfc7fd2a012d5205ed22d18eb39e41c8fbc95.tar.xz zsh-23bdfc7fd2a012d5205ed22d18eb39e41c8fbc95.zip |
28418: add ${NAME:OFFSET:LENGTH} substitution
Diffstat (limited to 'Test')
-rw-r--r-- | Test/D04parameter.ztst | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index fe978263f..7c6a465af 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -1256,3 +1256,49 @@ 0:$ZSH_EVAL_CONTEXT and $zsh_eval_context >toplevel >shfunc cmdsubst + + foo="123456789" + print ${foo:3} + print ${foo: 1 + 3} + print ${foo:$(( 2 + 3))} + print ${foo:$(echo 3 + 3)} + print ${foo:3:1} + print ${foo: 1 + 3:(4-2)/2} + print ${foo:$(( 2 + 3)):$(( 7 - 6 ))} + print ${foo:$(echo 3 + 3):`echo 4 - 3`} + print ${foo: -1} + print ${foo: -10} +0:Bash-style subscripts, scalar +>3456789 +>456789 +>56789 +>6789 +>3 +>4 +>5 +>6 +>9 +>123456789 + + foo=(1 2 3 4 5 6 7 8 9) + print ${foo:3} + print ${foo: 1 + 3} + print ${foo:$(( 2 + 3))} + print ${foo:$(echo 3 + 3)} + print ${foo:3:1} + print ${foo: 1 + 3:(4-2)/2} + print ${foo:$(( 2 + 3)):$(( 7 - 6 ))} + print ${foo:$(echo 3 + 3):`echo 4 - 3`} + print ${foo: -1} + print ${foo: -10} +0:Bash-style subscripts, array +>3 4 5 6 7 8 9 +>4 5 6 7 8 9 +>5 6 7 8 9 +>6 7 8 9 +>3 +>4 +>5 +>6 +>9 +>1 2 3 4 5 6 7 8 9 |