From 37ea2266f8d0613e3d4ae5e39ab8e7188207f17e Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 26 Mar 2020 14:03:26 +0100 Subject: zshrc: Only add full hostnames from work known_hosts Signed-off-by: Florian Pritz --- .zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index c44ffef..f199c66 100644 --- a/.zshrc +++ b/.zshrc @@ -766,7 +766,7 @@ alias h=sshrc # complete ssh hostnames [[ -r ~/.ssh/known_hosts ]] && _ssh_hosts=(${${${${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}%%:*}#\[}%\]}) || _ssh_hosts=() -[[ -r ~/.ssh/known_hosts_work ]] && _ssh_hosts+=($(cut -d\ -f1 ~/.ssh/known_hosts ~/.ssh/known_hosts_work | tr , "\n" | sed -r 's#(_ecdsa|_rsa|_ed25519|_dsa)$##')) || true +[[ -r ~/.ssh/known_hosts_work ]] && _ssh_hosts+=($(cut -d\ -f1 ~/.ssh/known_hosts ~/.ssh/known_hosts_work | tr , "\n" | sed -r 's#(_ecdsa|_rsa|_ed25519|_dsa)$##' | grep -F .)) || true [[ -r ~/.ssh/config ]] && _ssh_config_hosts=($(sed -rn 's/host\s+(.+)/\1/ip' "$HOME/.ssh/config" | grep -v "\*" )) || _ssh_config_hosts=() hosts=( $HOST -- cgit v1.2.3-24-g4f1b