X-Git-Url: http://git.grml.org/?p=grml-etc-core.git;a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;fp=etc%2Fzsh%2Fzshrc;h=60f37118414a97af0b73386171e5a47bae39a91b;hp=9ae63af559ea9164702afbb6f909c8f0bae83fdc;hb=220d6ffaba8a58e71c6c51d30196c6fe07f18e37;hpb=25cc5b499988ef7e8d4031b85d9f49b48dcc22d6 diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 9ae63af..60f3711 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -891,14 +891,20 @@ function grmlcomp () { fi # host completion + _etc_hosts=() + _ssh_config_hosts=() + _ssh_hosts=() if is42 ; then - [[ -r ~/.ssh/config ]] && _ssh_config_hosts=(${${(s: :)${(ps:\t:)${${(@M)${(f)"$(<$HOME/.ssh/config)"}:#Host *}#Host }}}:#*[*?]*}) || _ssh_config_hosts=() - [[ -r ~/.ssh/known_hosts ]] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() - [[ -r /etc/hosts ]] && [[ "$NOETCHOSTS" -eq 0 ]] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(grep -v '^0\.0\.0\.0\|^127\.0\.0\.1\|^::1 ' /etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=() - else - _ssh_config_hosts=() - _ssh_hosts=() - _etc_hosts=() + if [[ -r ~/.ssh/config ]] ; then + _ssh_config_hosts=(${${(s: :)${(ps:\t:)${${(@M)${(f)"$(<$HOME/.ssh/config)"}:#Host *}#Host }}}:#*[*?]*}) + fi + + if [[ -r ~/.ssh/known_hosts ]] ; then + _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) + + if [[ -r /etc/hosts ]] && [[ "$NOETCHOSTS" -eq 0 ]] ; then + : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(grep -v '^0\.0\.0\.0\|^127\.0\.0\.1\|^::1 ' /etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} + fi fi local localname