_known_hosts_real: Exclude %h HostName entries (RedHat: #1015935).
This commit is contained in:
parent
d482e74682
commit
fcc9545b44
@ -1552,7 +1552,7 @@ _known_hosts_real()
|
|||||||
|
|
||||||
# append any available aliases from config files
|
# append any available aliases from config files
|
||||||
if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then
|
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" \
|
COMPREPLY+=( $( compgen -P "$prefix$user" \
|
||||||
-S "$suffix" -W "$hosts" -- "$cur" ) )
|
-S "$suffix" -W "$hosts" -- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
|
1
test/fixtures/_known_hosts_real/config
vendored
1
test/fixtures/_known_hosts_real/config
vendored
@ -2,5 +2,6 @@
|
|||||||
|
|
||||||
# Unindented
|
# Unindented
|
||||||
Host gee jar
|
Host gee jar
|
||||||
|
HostName %h.example.com
|
||||||
# Indented
|
# Indented
|
||||||
Host hus # With comment
|
Host hus # With comment
|
||||||
|
Loading…
x
Reference in New Issue
Block a user