Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ssh completion



On Aug 28, 10:09am, Nemeth Ervin wrote:
} Subject: Re: ssh completion
}
} Here is a bit better one:
} 
} zstyle '*ssh*' hosts $(sed -e '/^#/d
} s/ .*$//
} s/,/ /g' /etc/ssh_known_hosts ~/.ssh/known_hosts)

That one gives me

sed: can't read /etc/ssh_known_hosts: No such file or directory

so it might be a good idea to redirect stderr.

Also, ~/.ssh/known_hosts is sometimes rewritten by ssh, so if the following
isn't too slow, you might try it -- it re-reads the files whenever the style
is tested:

zstyle -e ':completion:*:ssh:*' hosts \
	'reply=($(sed -e "/^#/d" -e "s/ .*\$//" -e "s/,/ /g" \
		/etc/ssh_known_hosts ~/.ssh/known_hosts 2>/dev/null))'

Finally, note that the above works for ssh version 1 and openssh, but not
for ssh2.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author