From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8202 invoked from network); 15 Jun 2002 23:07:40 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 15 Jun 2002 23:07:40 -0000 Received: (qmail 419 invoked by alias); 15 Jun 2002 23:07:21 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5058 Received: (qmail 403 invoked from network); 15 Jun 2002 23:07:18 -0000 From: "Bart Schaefer" Message-Id: <1020615230648.ZM1844@candle.brasslantern.com> Date: Sat, 15 Jun 2002 23:06:48 +0000 In-Reply-To: <87it4l7vcy.fsf@lexx.delysid.org> Comments: In reply to Mario Lang "{(t)...} usage" (Jun 14, 5:06pm) References: <87it4l7vcy.fsf@lexx.delysid.org> X-Mailer: Z-Mail (5.0.0 30July97) To: Mario Lang , zsh-users@sunsite.dk Subject: Re: {(t)...} usage MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 14, 5:06pm, Mario Lang wrote: } Subject: {(t)...} usage } } ... I'd like to use a unique array, and I found } the (t) flag in the manpages. } } There is just no example there, and I didnt figure out how } to use it. I'd like to know which manual you're reading, because the (t) flag has nothing to do with unique arrays. It reports the -type- of a parameter ("parameter" is another word for "variable" in zsh parlance). There is a (u) flag in the 4.1.x-dev versions, but it's not available in zsh 4.0.x or 3.anything. However, you're on a wild goose chase. You don't need to make the array unique. The completion system will take care of doing that before it offers you any choices. } ${(t)array-unique $(grep -v "^#" /etc/hosts) ${...some_ssh_known_hosts_too}) There is so much wrong here that I don't have time even to begin to figure out what you actually meant, never mind explaining how to fix it. Please read Chapter 5 of Peter Stephenson's Zsh User's Guide. It explains many details of parameter substitutions, with a lot of examples. Meanwhile, if you don't mind simply pasting someone else's black magic into your .zshrc file, the following will probably make your completion work mostly the way you want: zstyle -e ':completion:*:(ssh|scp):*' hosts 'reply=( ${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) \ /dev/null)"}%%[# ]*}//,/ } ${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*} )' -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net