mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-22 16:20:23 +02:00
19707: negative index into arrays should return scalar and not one element array
This commit is contained in:
parent
43513b4288
commit
3023ddf132
3 changed files with 24 additions and 2 deletions
|
@ -3,6 +3,7 @@
|
|||
%prep
|
||||
|
||||
foo=(a b c d e f g)
|
||||
arr=(foo bar baz)
|
||||
mkdir array.tmp
|
||||
touch array.tmp/{1..9}
|
||||
|
||||
|
@ -60,6 +61,20 @@
|
|||
0:A slice with a negative start and end
|
||||
>.b c d e f.
|
||||
|
||||
echo .${${arr[2]}[1]}.
|
||||
echo .${${arr[-2]}[1]}.
|
||||
echo .${${arr[2,2]}[1]}.
|
||||
echo .${${arr[-2,-2]}[1]}.
|
||||
echo .${${arr[2,-2]}[1]}.
|
||||
echo .${${arr[-2,2]}[1]}.
|
||||
0:Slices should return an array, elements a scalar
|
||||
>.b.
|
||||
>.b.
|
||||
>.bar.
|
||||
>.bar.
|
||||
>.bar.
|
||||
>.bar.
|
||||
|
||||
setopt ksh_arrays
|
||||
echo .${foo[1,2]}.
|
||||
unsetopt ksh_arrays
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue