Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: hostname completion for ssh / scp
- X-seq: zsh-users 22086
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: hostname completion for ssh / scp
- Date: Sat, 5 Nov 2016 10:24:55 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=WpXORmeb3tx7pj0hp5wHTMJby+ZUpGOs+kJh7/oW97U=; b=Vm4oXvzXx+lrJ5USmB29yljgNY2m1P0Dnqa+nE9PbJpv51+dZZxaaGTAVUqQ5NYVu4 CtJ1uzMb9dKx6maXmt/sbf29M3UwzeKiNiPYaXagGIzWnv4DE+MfTLOZ3NF6Uq5ooIUq kO2/AYzsZf7e3FsM+9YK27bqXooas87VIAhOma/Kzqh8nLOUhbhfOAI4LB3m7fEysCxT zFZJjcipfgzM3F3WqmjcZN+7wHvoObakrjyZ+z1+TWGG04peoNwol57CeKd4pMJP+3bG iks0KaG1EILqE5W1qK2Ex9yLT6BVUhiqybuC+pv8qwl4roAooeJH/AJ4zWJe/AU2CuNV CeXg==
- In-reply-to: <581D9E98.1000008@gmx.ch>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <581B8BCE.2040108@gmx.ch> <161104214237.ZM18518@torch.brasslantern.com> <581D9E98.1000008@gmx.ch>
On Nov 5, 9:55am, Fourhundred Thecat wrote:
}
} I believe, getent hosts only returns hosts which have ip address
} specified in /etc/hosts
Well, yes. The syntax of the /etc/hosts file is first an IP and then
a hostname. Somebody will possibly correct me, but I don't recall
any valid use of /etc/hosts that has lines of host names without IPs.
} > 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.
This shouldn't change the behavior with respect to ~/.ssh/config
because that's read in _ssh_hosts rather than in _hosts where the
style above applies.
_hosts reads ~/.ssh/known_hosts whether or not the program named by
the command style returns anything.
However, ~/.ssh/config will be skipped if the users-hosts tag finds
any matching hosts, which is likely to happen if you are starting
from a blank word, because users-hosts calls _hosts which will look
in known_hosts. If you start with a prefix on the line that matches
a host in ~/.ssh/config and does NOT match one in ~/.ssh/known_hosts,
you should get a completion.
} > 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 ?
I don't think so (you'd need at least _hosts as well) but in any case
it wouldn't change anything because even 5.0+ is not expecting you to
have just dumped a bunch of bare host names into /etc/hosts like that.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author