From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25252 invoked from network); 5 Oct 2006 13:24:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.5 (2006-08-29) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 5 Oct 2006 13:24:11 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 71600 invoked from network); 5 Oct 2006 13:24:05 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Oct 2006 13:24:05 -0000 Received: (qmail 28189 invoked by alias); 5 Oct 2006 13:23:57 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10786 Received: (qmail 28180 invoked from network); 5 Oct 2006 13:23:56 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 5 Oct 2006 13:23:56 -0000 Received: (qmail 70422 invoked from network); 5 Oct 2006 13:23:56 -0000 Received: from cluster-c.mailcontrol.com (168.143.177.190) by a.mx.sunsite.dk with SMTP; 5 Oct 2006 13:23:51 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly16c.srv.mailcontrol.com (MailControl) with ESMTP id k95DMLar019872 for ; Thu, 5 Oct 2006 14:23:48 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Thu, 5 Oct 2006 14:21:57 +0100 Date: Thu, 5 Oct 2006 14:21:57 +0100 From: Peter Stephenson To: zsh-users@sunsite.dk Subject: Re: ssh user name completion Message-Id: <20061005142157.f245ae41.pws@csr.com> In-Reply-To: <87ejtotjnt.fsf@magma.ca> References: <87ejtotjnt.fsf@magma.ca> Organization: Cambridge Silicon Radio X-Mailer: Sylpheed version 2.2.9 (GTK+ 2.8.20; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 05 Oct 2006 13:21:57.0823 (UTC) FILETIME=[3BCB1CF0:01C6E881] X-Scanned-By: MailControl A-07-04-02 (www.mailcontrol.com) on 10.67.0.126 Angelina Carlton wrote: > #ssh completion > local _myhosts; > _myhosts=( ${${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ }:#\!*} > ${=${(f)"$(cat /etc/hosts(|)(N) < (ypcat hosts 2>/dev/null))"}%%\#*} ); > zstyle ':completion:*' hosts $_myhosts; > > I got this code from a zshrc I found on the net, but i don't pretend to > understand how exactly it works, or even if it is the correct way to do > ssh conmpletion.. You should find recent versions of zsh have this in by default. > The problem is on the Debian Stable server, if I type: > ssh u > the shell expands to: > ssh username@ > then I type the first letter of the host and it expands that as well. > This is excellent behaviour and makes things very fast. > > However on my Debian unstable computer, typing: > ssh u > will just make the shell beep, as it seems not to know how to complete > the command. I have to manually type in the username@ string and then it > will complete the hostname for me. The code you show doesn't do anything special for user names. The current support built into the completion system adds any users stored in the style "users", then any found by scanning the system's password database. This doesn't appear to have changed recently. Try setting a few user names for it to complete explicitly and see if that works: zstyle ":completion:*" users arthur brenda charlie deirdre To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php