diff --git a/bash_completion b/bash_completion index 3360873a..c684a8fd 100644 --- a/bash_completion +++ b/bash_completion @@ -1552,7 +1552,7 @@ _known_hosts_real() # append any available aliases from config files if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then - local hosts=$( sed -ne 's/^['"$'\t '"']*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" ) + local hosts=$( sed -ne 's/^['"$'\t '"']*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t '"']\{1,\}\([^#*?%]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" ) COMPREPLY+=( $( compgen -P "$prefix$user" \ -S "$suffix" -W "$hosts" -- "$cur" ) ) fi diff --git a/test/fixtures/_known_hosts_real/config b/test/fixtures/_known_hosts_real/config index 77770ffe..1231dd79 100644 --- a/test/fixtures/_known_hosts_real/config +++ b/test/fixtures/_known_hosts_real/config @@ -2,5 +2,6 @@ # Unindented Host gee jar + HostName %h.example.com # Indented Host hus # With comment