From 1b8c7b961cabbebbac1b2e48f89ee8205c48bdbf Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Sun, 1 Feb 2015 08:54:35 -0800 Subject: [PATCH] ovs-command-completion: Avoid using negative subscript. Negative subscript causes error in bash version 4.1.2(1)-release (x86_64-redhat-linux-gnu). This commit fixes it. Signed-off-by: Alex Wang Acked-by: Ben Pfaff --- utilities/ovs-command-compgen.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/ovs-command-compgen.bash b/utilities/ovs-command-compgen.bash index fa3f1e6c3..b9df527ec 100755 --- a/utilities/ovs-command-compgen.bash +++ b/utilities/ovs-command-compgen.bash @@ -600,8 +600,8 @@ if [ "$1" = "debug" ]; then # next argument which is not input yet. This hack is for # compromising the fact that bash cannot take unquoted # empty argument. - if [ "${COMP_WORDS[-1]}" = "TAB" ]; then - COMP_WORDS[${#COMP_WORDS[@]}-1]="" + if [ "${COMP_WORDS[$COMP_CWORD]}" = "TAB" ]; then + COMP_WORDS[$COMP_CWORD]="" fi _ovs_command_complete "debug" -- 2.39.5