* compctl - aliasing hostnames
@ 1998-07-30 21:07 Sven Guckes
1998-07-30 22:36 ` Bart Schaefer
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Sven Guckes @ 1998-07-30 21:07 UTC (permalink / raw)
To: zsh-users
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:
Sven
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: compctl - aliasing hostnames
1998-07-30 21:07 compctl - aliasing hostnames Sven Guckes
@ 1998-07-30 22:36 ` Bart Schaefer
1998-07-31 1:45 ` Geoff Wing
1998-08-04 3:38 ` compctl - aliasing hostnames Todd Graham Lewis
2 siblings, 0 replies; 10+ messages in thread
From: Bart Schaefer @ 1998-07-30 22:36 UTC (permalink / raw)
To: Sven Guckes, zsh-users
On Jul 30, 11:07pm, Sven Guckes wrote:
> Subject: compctl - aliasing hostnames
> I'd like to type "ssh alias" and be connected with "ssh hostname".
> How could you "alias" a hostname with completion control?
Use "alias -g":
zsh% alias -g fnorgle=aixhost
zsh% ssh fnorgle
user@aixhost's Password:
Of course, that means that fnorgle will be replaced by aixhost everywhere
in all commands, not just in the ssh command.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: compctl - aliasing hostnames
1998-07-30 21:07 compctl - aliasing hostnames 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-08-04 3:38 ` compctl - aliasing hostnames Todd Graham Lewis
2 siblings, 1 reply; 10+ messages in thread
From: Geoff Wing @ 1998-07-31 1:45 UTC (permalink / raw)
To: zsh-users
Sven Guckes <guckes@math.fu-berlin.de> typed:
: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:
ssh has a config file for this. You don't need to do it with zsh.
RTFM ssh(1)
Something along the lines of:
Host alias1
Hostname realname1
User user1
Host alias2
Hostname realname2
# User user2 - unnecessary 'cos I'm the same as this host I'm sitting on
Host alias3
Hostname realname3
User user3
--
Geoff Wing <gcw@pobox.com> Mobile : 0412 162 441
Work URL: http://www.primenet.com.au/ Ego URL: http://pobox.com/~gcw/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: compctl - aliasing hostnames -> ~/.ssh/config
1998-07-31 1:45 ` Geoff Wing
@ 1998-07-31 15:02 ` Sven Guckes
1998-07-31 15:25 ` Roland Jesse
0 siblings, 1 reply; 10+ messages in thread
From: Sven Guckes @ 1998-07-31 15:02 UTC (permalink / raw)
To: zsh-users
Quoting Geoff Wing (mason@primenet.com.au):
> You don't need to do it with zsh.
> ssh has a config file for this.
> RTFM ssh(1)
Indeed. Sorry about the noise.
And thanks for the example! :-)
Here's my example:
$ cat ~/.ssh/config
Host gauss
Hostname Tr1ckyh0stNam3
User argl0815
$ ssh gauss
argl0815@Tr1ckyh0stNam3's password:
Sven [who really likes examples]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: compctl - aliasing hostnames -> ~/.ssh/config
1998-07-31 15:02 ` compctl - aliasing hostnames -> ~/.ssh/config Sven Guckes
@ 1998-07-31 15:25 ` Roland Jesse
0 siblings, 0 replies; 10+ messages in thread
From: Roland Jesse @ 1998-07-31 15:25 UTC (permalink / raw)
To: zsh-users
Sven Guckes wrote:
> $ cat ~/.ssh/config
Which can of course be optimized to '< ~/.ssh/config'. ;-)
SCNR,
Roland
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: compctl - aliasing hostnames
1998-07-30 21:07 compctl - aliasing hostnames Sven Guckes
1998-07-30 22:36 ` Bart Schaefer
1998-07-31 1:45 ` Geoff Wing
@ 1998-08-04 3:38 ` Todd Graham Lewis
1998-08-04 15:33 ` compctl - using hostnames with rlogin, rsh, and ssh Sven Guckes
2 siblings, 1 reply; 10+ messages in thread
From: Todd Graham Lewis @ 1998-08-04 3:38 UTC (permalink / raw)
To: Sven Guckes; +Cc: zsh-users
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: compctl - using hostnames with rlogin, rsh, and ssh
1998-08-04 3:38 ` compctl - aliasing hostnames Todd Graham Lewis
@ 1998-08-04 15:33 ` Sven Guckes
1998-08-04 18:45 ` Roland Jesse
0 siblings, 1 reply; 10+ messages in thread
From: Sven Guckes @ 1998-08-04 15:33 UTC (permalink / raw)
To: zsh-users
Quoting Todd Graham Lewis (tlewis@mindspring.net):
> 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@math.fu-berlin.de 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: compctl - using hostnames with rlogin, rsh, and ssh
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
0 siblings, 1 reply; 10+ messages in thread
From: Roland Jesse @ 1998-08-04 18:45 UTC (permalink / raw)
To: zsh-users
Sven Guckes writes:
> if [[ -f ~/.zshhosts ]]; then
> # read in host list from ~/.zshhosts
> hosts=$(< ~/.zshhosts)
Does it matter whether the hostnames in ~/.zshhosts are all stored in
one big line or in one line per host name?
Roland
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: compctl - using hostnames with rlogin, rsh, and ssh
1998-08-04 18:45 ` Roland Jesse
@ 1998-08-04 19:11 ` Sven Guckes
1998-08-04 22:47 ` Thomas Köhler
0 siblings, 1 reply; 10+ messages in thread
From: Sven Guckes @ 1998-08-04 19:11 UTC (permalink / raw)
To: zsh-users
> if [[ -f ~/.zshhosts ]]; then
> # read in host list from ~/.zshhosts
> hosts=$(< ~/.zshhosts)
Quoting Roland Jesse (jesse@prinz-atm.cs.Uni-Magdeburg.DE):
> Does it matter whether the hostnames in ~/.zshhosts are
> all stored in one big line or in one line per host name?
Well, my ~/.zshhosts has one hostname per line.
Dunno whether it'll work with all hosts on one line.
Oh, heck, I'll give it a try:
:%j
:w
:shell
$ ssh <TAB>
$ ssh erdos\ euler\ gauss\ leibniz\ pascal\
Nope, doesn't seem to work.
Sven ['u', ":w" ;-)]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: compctl - using hostnames with rlogin, rsh, and ssh
1998-08-04 19:11 ` Sven Guckes
@ 1998-08-04 22:47 ` Thomas Köhler
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Köhler @ 1998-08-04 22:47 UTC (permalink / raw)
To: zsh-users
On Tue, Aug 04, 1998 at 09:11:10PM +0200, Sven Guckes wrote:
> > if [[ -f ~/.zshhosts ]]; then
> > # read in host list from ~/.zshhosts
> > hosts=$(< ~/.zshhosts)
>
> Quoting Roland Jesse (jesse@prinz-atm.cs.Uni-Magdeburg.DE):
> > Does it matter whether the hostnames in ~/.zshhosts are
> > all stored in one big line or in one line per host name?
>
> Well, my ~/.zshhosts has one hostname per line.
> Dunno whether it'll work with all hosts on one line.
> Oh, heck, I'll give it a try:
>
> :%j
> :w
> :shell
> $ ssh <TAB>
> $ ssh erdos\ euler\ gauss\ leibniz\ pascal\
>
> Nope, doesn't seem to work.
Not this way, no. You did a
hosts=$(< ~/.zshhosts)
which doesn't work because all is in a variable. Try an array instead:
hosts=($(< ~/.zshhosts))
This will work whether or not all hosts are in one line or there is one
hostname per line.
~> shosts=($(< sshhosts))
~> compctl -k shosts ssh
~> ssh a<tab>
~> ssh automatix.informatik.uni-wuerzburg.de
~> rhosts=($(< rshhosts))
~> compctl -k rhosts rsh
~> rsh a<tab>
~> rsh automatix.informatik.uni-wuerzburg.de
~> < sshhosts
automatix.informatik.uni-wuerzburg.de
datenbus.mayn.de
picard.franken.de
willkuere.informatik.uni-wuerzburg.de
~> < rshhosts
automatix.informatik.uni-wuerzburg.de datenbus.mayn.de picard.franken.de willkuere.informatik.uni-wuerzburg.de
~>
> Sven ['u', ":w" ;-)]
CU,
Thomas
--
Thomas Köhler Email: jean-luc@picard.franken.de
<>< WWW: http://home.pages.de/~jeanluc/
IRC: jeanluc
LCARS --- Linux for Computers on All Real Starships
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~1998-08-04 23:07 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-30 21:07 compctl - aliasing hostnames 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 ` compctl - aliasing hostnames Todd Graham Lewis
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
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).