From 9994be6476247261cb8d3e1befcce4af72a136b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 26 May 2020 23:52:37 +0300 Subject: [PATCH] _command_offset, route: cleanups --- bash_completion | 4 ++-- completions/route | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bash_completion b/bash_completion index 42910c069ad..536abdcea70 100644 --- a/bash_completion +++ b/bash_completion @@ -1922,9 +1922,9 @@ _command_offset() func=${func%% *} if ((${#COMP_WORDS[@]} >= 2)); then - $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]} - 1]}" "${COMP_WORDS[${#COMP_WORDS[@]} - 2]}" + $func $cmd "${COMP_WORDS[-1]}" "${COMP_WORDS[-2]}" else - $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]} - 1]}" + $func $cmd "${COMP_WORDS[-1]}" fi # restore initial compopts diff --git a/completions/route b/completions/route index b8ae618ed2c..f9b31964868 100644 --- a/completions/route +++ b/completions/route @@ -20,7 +20,7 @@ _route() for ((i = 1; i < ${#words[@]} - 1; i++)); do [[ ${words[i]} == "$opt" ]] && found=true && break done - $found || COMPREPLY[${#COMPREPLY[@]}]="$opt" + $found || COMPREPLY+=("$opt") done COMPREPLY=($(compgen -W '"${COMPREPLY[@]}"' -- "$cur"))