zsh-users
 help / color / mirror / code / Atom feed
From: Todd Graham Lewis <tlewis@mindspring.net>
To: Sven Guckes <guckes@math.fu-berlin.de>
Cc: zsh-users@math.gatech.edu
Subject: Re: compctl - aliasing hostnames
Date: Mon, 3 Aug 1998 23:38:55 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.3.96.980803233328.19072E-100000@reflections.eng.mindspring.net> (raw)
In-Reply-To: <19980730230755.B6503@math.fu-berlin.de>

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


  parent reply	other threads:[~1998-08-04  4:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-30 21:07 Sven Guckes
1998-07-30 22:36 ` Bart Schaefer
1998-07-31  1:45 ` Geoff Wing
1998-07-31 15:02   ` compctl - aliasing hostnames -> ~/.ssh/config Sven Guckes
1998-07-31 15:25     ` Roland Jesse
1998-08-04  3:38 ` Todd Graham Lewis [this message]
1998-08-04 15:33   ` compctl - using hostnames with rlogin, rsh, and ssh Sven Guckes
1998-08-04 18:45     ` Roland Jesse
1998-08-04 19:11       ` Sven Guckes
1998-08-04 22:47         ` Thomas Köhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.3.96.980803233328.19072E-100000@reflections.eng.mindspring.net \
    --to=tlewis@mindspring.net \
    --cc=guckes@math.fu-berlin.de \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).