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

Re: compctl - using hostnames with rlogin, rsh, and ssh



Quoting Todd Graham Lewis (tlewis@xxxxxxxxxxxxxx):
>     compctl -k hostlist ssh
> 
>     function hosts(){
>         unset hostlist
>         echo "Enter password on hunterd for host completion.  "
>         set -A hostlist `echo "select hostname,status from hosttable;"\
>           | ssh dbserver "psql hostdb 2>/dev/null"\
>           | grep Active\
>           | sed 's/|/ /g'\
>           | awk '{print $1}'`
>         # echo "hosts are $hostlist"
>     }

Looks like this could take quite a while to process.
I would rather use a given deafult list of hosts.

Here is the solution with the zsh setup at our site:

	hosts="" # make hosts an empty list
	if [[ -f ~/.zshhosts ]]; then
	  # read in host list from ~/.zshhosts
	  hosts=$(< ~/.zshhosts)
	  set -A hosts ${(f)hosts}
	else
	  # set the default host list
	  hosts=(erdos euler gauss leibniz pascal)

	compctl -k hosts -x 'p[2,-1]' -l '' -- rsh ssh
	compctl -k hosts -x 'c[-1,-l]' -u -- rlogin

Comments?

Sven

-- 
Sven Guckes guckes@xxxxxxxxxxxxxxxxx            using zsh-3.0.5 [961218]
ZSH HomePage: http://www.zsh.org   | Latest version:  zsh-3.1.4 [980601]
ZSH Pages:    http://www.math.fu-berlin.de/~guckes/zsh/  Tips and tricks



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