robbyrussell/oh-my-zsh — pull request #2489 by ncanceill (2014-02-02 12:46:50+00:00)
Title: Remove brackets from URLs when parsing user SSH known hosts

With *OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011* the hostnames from `$HOME/.ssh/known_hosts` are surrounded by brackets when the URL includes a custom port — _ie_ not port 22, _eg_ `[100.200.30.40]:1234`.

Those brackets need to be removed for `ssh` completion. This is done by adding two more parameter substitutions — maybe there is a more elegant way, feel free to improve.

This change should not break anything: the substitutions are performed last so they should not have any undesirable side-effect, and brackets are forbidden in FQDNs anyway.

Maybe this is also necessary for `/etc/ssh/known_hosts` but I am not able to reproduce that configuration right now.