From 457dbf6061eea5f2d1e3bccacf1691265f7321cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 2 May 2011 13:51:55 +0300 Subject: [PATCH] _init_completion: Indicate that completion should not continue if cword == 0. http://thread.gmane.org/gmane.comp.shells.bash.bugs/16499 http://lists.alioth.debian.org/pipermail/bash-completion-devel/2011-May/003635.html Thanks-to: Igor Murzov --- bash_completion | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash_completion b/bash_completion index 77e76b31..e88e2fc8 100644 --- a/bash_completion +++ b/bash_completion @@ -740,7 +740,9 @@ _init_completion() i=$(( ++i )) fi done - [[ $cword -ge 1 ]] && prev=${words[cword-1]} || prev= + + [[ $cword -eq 0 ]] && return 1 + prev=${words[cword-1]} [[ $split ]] && _split_longopt && split=true