From 23bdfc7fd2a012d5205ed22d18eb39e41c8fbc95 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 18 Nov 2010 10:07:55 +0000 Subject: 28418: add ${NAME:OFFSET:LENGTH} substitution --- Test/D04parameter.ztst | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'Test/D04parameter.ztst') 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 -- cgit 1.4.1