From: Fourhundred Thecat <400thecat@gmx.ch>
To: Bart Schaefer <schaefer@brasslantern.com>, zsh-users@zsh.org
Subject: Re: hostname completion for ssh / scp
Date: Sat, 05 Nov 2016 09:55:52 +0100 [thread overview]
Message-ID: <581D9E98.1000008@gmx.ch> (raw)
In-Reply-To: <161104214237.ZM18518@torch.brasslantern.com>
> On 2016-11-05 05:42, Bart Schaefer wrote:
> On Nov 3, 8:11pm, Fourhundred Thecat wrote:
> } Subject: hostname completion for ssh / scp
> }
> } ssh <TAB>
> }
> } it offers me only the hostnames listed in ~/.ssh/config and completely
> } ignores global ones defined in /etc/hosts
> }
> } Tested on zsh 4.3.17
>
> What does
> getent hosts
> return on your system? That's where _hosts gets the list of hosts.
getent hosts only returns first two lines from /etc/hosts, and ignores
the rest:
127.0.0.1 localhost
127.0.1.1 laptop
I believe, getent hosts only returns hosts which have ip address
specified in /etc/hosts, such as:
1.2.3.4 myserver1.com
> If getent isn't returning anything useful, you can replace it:
>
> zstyle ':completion:*:hosts' command 'cat /etc/hosts'
I would like to keep the completion from ~/.ssh/config and add
completion from /etc/hosts.
I cannot just use
zstyle ':completion:*:hosts' command 'cat /etc/hosts ~/.ssh/config'
because the syntax in ~/.ssh/config is more tricky (multiline host
definition), and I don't want options to be interpreted as hostnames.
> Or explicitly list all the hosts yourself:
>
> zstyle ':completion:*:hosts' hosts $(awk '/^[^#]/ {print $2}' /etc/hosts)
same as above
> Note there have been several other fixes/improvements to ssh host-gathering
> since zsh 5.0.
can I simply copy Unix/_ssh from zsh 5.0. and use it on zsh 4.3.17 ?
next prev parent reply other threads:[~2016-11-05 8:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 19:11 Fourhundred Thecat
2016-11-05 4:42 ` Bart Schaefer
2016-11-05 8:55 ` Fourhundred Thecat [this message]
2016-11-05 17:24 ` Bart Schaefer
2016-11-05 18:54 ` Fourhundred Thecat
2016-11-05 20:29 ` Bart Schaefer
2016-11-05 20:54 ` Fourhundred Thecat
2016-11-05 22:53 ` Bart Schaefer
2016-11-06 8:49 ` Fourhundred Thecat
2016-11-06 17:41 ` Bart Schaefer
[not found] ` <581E2AE5.4040006__46101.1380576112$1478372966$gmane$org@gmx.ch>
2016-11-05 20:31 ` Daniel Shahaf
2016-11-05 20:50 ` Fourhundred Thecat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=581D9E98.1000008@gmx.ch \
--to=400thecat@gmx.ch \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).