Skip to content

Commit 76ee1c2

Browse files
committed
fix(_comp_last_index): use ${arr[*]: -1} to get the last element
1 parent 1326474 commit 76ee1c2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

completions/ARRAY

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ _comp_uniq()
166166
_comp_last_index()
167167
{
168168
local -n _comp_last_index__array=$1 _comp_last_index__ret=$2
169-
local -i _comp_last_index__i
170-
for _comp_last_index__i in "${!_comp_last_index__array[@]}"; do :; done
171-
_comp_last_index__ret=$_comp_last_index__i
169+
local -a _comp_last_index__indices=("${!_comp_last_index__array[@]}")
170+
_comp_last_index__ret=${_comp_last_index__indices[*]: -1}
172171
}
173172

174173
_comp_compact()

0 commit comments

Comments
 (0)