Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: outputs of _users and _hosts to arrays



On 07/26/2005, at 10:56, Wataru Kagawa wrote:

hosts=( ${$( cat /etc/hosts | cut -d : -f 1,7 | grep -v "#" )//:*/} )

to get what I need.

This has the same problem, but I don't know a better way well. Using some functions from Perl or some other language?

Do you mean that the commands inside the parameter expansion may work on Mac OS X but not on other computers?
On some systems using NIS, you can get host names of your network from shared database, IIRC.


But I think you can get better results by setting hosts manually.

% zstyle ':completion:*' hosts ${${(f)"$(<~/.ssh/known_hosts)"}%% [[:space:],]*}

see http://www.zsh.org/mla/users/2005/msg00084.html



Messages sorted by: Reverse Date, Date, Thread, Author