diff --git a/completions/ssh.completion.sh b/completions/ssh.completion.sh index c402837de..406b71847 100644 --- a/completions/ssh.completion.sh +++ b/completions/ssh.completion.sh @@ -45,7 +45,11 @@ function _omb_completion_ssh { fi done if ((${#config_files[@]} != 0)); then - COMPREPLY+=( $(compgen -W "$(awk '/^[ \t]*[Hh][Oo][Ss][Tt][ \t=]+/ {gsub(/^[ \t]+|[ \t]+$/, ""); n=split($0, fields, /[ \t=]+/); for (i=2; i<=n; i++) if (fields[i] && !(fields[i] in hosts)) hosts[fields[i]]=1;} /^[ \t]*[Hh][Oo][Ss][Tt][Nn][Aa][Mm][Ee][ \t=]+/ {gsub(/^[ \t]+|[ \t]+$/, ""); n=split($0, fields, /[ \t=]+/); for (i=2; i<=n; i++) if (fields[i] && !(fields[i] in hosts)) hosts[fields[i]]=1;} /^[ \t]*$/ {current="";} END {for (host in hosts) print host;}' "${config_files[@]}")" "${options[@]}") ) + COMPREPLY+=($(compgen -W "$(awk ' + sub(/^[ \t]*[Hh][Oo][Ss][Tt]([Nn][Aa][Mm][Ee])?[ \t=]+/, "") { + n = split($0, fields, /[ \t]+/); + for (i = 1; i <= n; i++) if (fields[i] && !visited[fields[i]]++) print fields[i]; + }' "${config_files[@]}")" "${options[@]}") ) fi local -a known_hosts_files=()