17
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Last updated at Posted at 2012-12-10

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

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

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

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

ssh [tab]
host1 host2 ....

簡単すぎる orz

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

17
16
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?