Ignore hashed host names in ssh/known_hosts

Valid DNS names cannot have a | character and hashed ssh hosts
always begin with the | character. Therefore we ignore lines that
begin with |.

Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
This commit is contained in:
Greg Dietsche 2013-04-01 16:42:40 -05:00 committed by ridiculousfish
parent 2626b83b08
commit d38f1380e9

View file

@ -13,7 +13,7 @@ function __fish_print_hostnames -d "Print a list of known hostnames"
end
# Print hosts with known ssh keys
cat ~/.ssh/known_hosts{,2} ^/dev/null|cut -d ' ' -f 1| cut -d , -f 1
cat ~/.ssh/known_hosts{,2} ^/dev/null | grep -v '^|' | cut -d ' ' -f 1| cut -d , -f 1
# Print hosts from ssh configuration file
if [ -e ~/.ssh/config ]