From 5599b21c5fa6ceffa1be24b2974a4d402d06bf7a Mon Sep 17 00:00:00 2001 From: Jörn-Thorben Hinz <11910-jth@users.noreply.salsa.debian.org> Date: Thu, 3 Feb 2022 23:16:30 +0100 Subject: bash-completion: Use the correct index range when looking for the command word MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $words[0] contains the first word on the command-line, the name of the program: apt. Also, the last word already typed on the command-line might be the command, don’t ignore it. --- completions/bash/apt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completions/bash/apt b/completions/bash/apt index 35716e7a7..94ad974b1 100644 --- a/completions/bash/apt +++ b/completions/bash/apt @@ -52,7 +52,7 @@ _apt() "policy") local command i - for (( i=0; i < ${#words[@]}-1; i++ )); do + for (( i=1; i < ${#words[@]}; i++ )); do if [[ " ${COMMANDS[*]} " == *" ${words[i]} "* ]]; then command=${words[i]} break -- cgit v1.2.3-70-g09d2