From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18923 invoked from network); 4 Aug 1998 04:07:34 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 4 Aug 1998 04:07:34 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id XAA01876; Mon, 3 Aug 1998 23:59:49 -0400 (EDT) Resent-Date: Mon, 3 Aug 1998 23:36:02 -0400 (EDT) Date: Mon, 3 Aug 1998 23:38:55 -0400 (EDT) From: Todd Graham Lewis X-Sender: tlewis@reflections.eng.mindspring.net To: Sven Guckes cc: zsh-users@math.gatech.edu Subject: Re: compctl - aliasing hostnames In-Reply-To: <19980730230755.B6503@math.fu-berlin.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Resent-Message-ID: <"lHq4T3.0.CK.Y6enr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1700 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Thu, 30 Jul 1998, Sven Guckes wrote: > I'd like to type "ssh alias" and be connected with "ssh hostname". > How could you "alias" a hostname with completion control? Example: > > $ ssh alias > guckes@hostname's password: I just want tab completion among all of our server boxes, and I use the following to accomplish it: 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" } "psql" is the PostgreSQL command-line query tool. We track all of our servers in a relational database using PostgreSQL; cf. www.postgresql.org for more info. We did this because I got tired of not being able to do tab-completion on ssh's. 8^) One could also just take the list from ~/.ssh/known-hosts, on the theory that the weather today is pretty much like the weather yesterday. One could also set the completion command to run hosts(), where hosts() either dumps the host database as it does above, or scans known-hosts, when there's no match. This wasn't what you asked for, but maybe some people will find it useful. -- Todd Graham Lewis (800) 719-4664, x2804 ******Linux****** MindSpring Enterprises tlewis@mindspring.net