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

Re: Hostname Menu completion



On Monday 20 October 2003, at 23 h 42, the keyboard of Leslie Joshua Wang 
<rexo@xxxxxxxxxxxxx> wrote:

> Does anyone have any suggestion what is the best way to go about 
> creating a hostname completion system using zsh?

I believe that zsh has a different way to do it in its most recent versions 
but this works for me:

etchosts=( ${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blan
k:]]#}} )
sshhosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*})
ftphosts=(${${${(f)"$(tail +3 $HOME/.ncftp/bookmarks)"}#*,}%%,*})
hosts=($etchosts $sshhosts $ftphosts)
ncftpbookmarks=(${${(f)"$(tail +3 $HOME/.ncftp/bookmarks)"}%%,*}) 
ncftphosts=($ncftpbookmarks $ftphosts)

compctl -k hosts traceroute mtr ping echoping fping tcptraceroute




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