Thursday, April 03, 2008

Auto-complete ssh hostname in zsh

This zshrc snippet automatically search for ~/.ssh/known_hosts for hostnames for ssh, scp, and ping command. It requires perl.

compctl -f -k "(
        `cat .ssh/known_hosts | perl -lnae '@C=split(",", $F[0]); print for @C'`
)" ssh scp ping

0 意見:

My Bicycle Rides