diff options
author | Thomas Haller <thaller@redhat.com> | 2014-03-01 01:35:23 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-03-01 02:07:53 +0100 |
commit | 9d7a1d42534174fc059812bb5741a7bded92679f (patch) | |
tree | 999dfcde9c0118bcd0ef106b34f9eb4fbfb52835 | |
parent | 39dc39ec0af2e25c71f41bc27aabd10fbbecb888 (diff) | |
download | NetworkManager-9d7a1d42534174fc059812bb5741a7bded92679f.tar.gz |
cli/bash-completion: use printf instead of echo (because echo inteprets some --options)
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | cli/completion/nmcli | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/cli/completion/nmcli b/cli/completion/nmcli index 0661300364..2e3eea77a6 100644 --- a/cli/completion/nmcli +++ b/cli/completion/nmcli @@ -83,7 +83,7 @@ _nmcli_compl_match_option() for V; do case "$V" in "$S"*) - echo "$V" + printf "%s" "$V" return 0 ;; esac @@ -235,7 +235,7 @@ _nmcli_compl_ARGS() # split the comma separaeted domain string into its parts LOGD local oIFS="$IFS" IFS="," - local LOGD=($(echo "${words[1]}" | sed 's/\(^\|,\)/,#/g')) + local LOGD=($(printf '%s' "${words[1]}" | sed 's/\(^\|,\)/,#/g')) IFS="$oIFS" unset oIFS @@ -459,9 +459,6 @@ _nmcli_compl_ARGS() fi ;; *) - echo - echo "unexpected option. This is a bug in the completion. Check for \"${words[0]}\"" - echo return 1 ;; esac @@ -592,8 +589,8 @@ _nmcli() # _init_completion returns the words with all the quotes and escaping # characters. We don't care about them, drop them at first. - for i in ${!words[*]}; do - words[i]="$(echo "${words[i]}" | xargs 2>/dev/null || true)" + for i in ${!words[@]}; do + words[i]="$(printf '%s' "${words[i]}" | xargs printf '%s\n' 2>/dev/null || true)" done # In case the cursor is not at the end of the line, |