Help us understand the problem. What is going on with this article?

zsh、ssh の補完で .ssh/config の設定を読む。

More than 5 years have passed since last update.

補完関数を書いてみたかっただけなので既出かも知れない。

以前、.ssh/config の一覧を表示する何かを書いたのだが、
最近 zsh を始めたので練習がてらに移植してみる。

.zshrc
function _ssh {
  compadd `fgrep 'Host ' ~/.ssh/config | awk '{print $2}' | sort`;
}

で、ターミナル開き直して普通にコマンド打って補完

ssh [tab]
host1 host2 ....

簡単すぎる orz

次は known_hosts でも追加しようか?

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away