From a72d698d0d9ff9c158155b44cdc77376df31a317 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Tue, 30 Jul 2013 12:46:23 -0400 Subject: bash-completion: use a better definition of __contains_word - scope the iterator var - use the correct, quoted, non-expansion prone positional parameter notation - prevent expansion on RHS of comparison - remove unneeded explicit returns. This really should be defined only once... --- shell-completion/bash/hostnamectl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'shell-completion/bash/hostnamectl') diff --git a/shell-completion/bash/hostnamectl b/shell-completion/bash/hostnamectl index a57bffe15..38ab1344f 100644 --- a/shell-completion/bash/hostnamectl +++ b/shell-completion/bash/hostnamectl @@ -18,9 +18,10 @@ # along with systemd; If not, see . __contains_word () { - local word=$1; shift - for w in $*; do [[ $w = $word ]] && return 0; done - return 1 + local w word=$1; shift + for w in "$@"; do + [[ $w = "$word" ]] && return + done } _hostnamectl() { -- cgit v1.2.3