From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28328 invoked from network); 24 Jul 2005 09:33:47 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 24 Jul 2005 09:33:47 -0000 Received: (qmail 25718 invoked from network); 24 Jul 2005 09:33:39 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 24 Jul 2005 09:33:39 -0000 Received: (qmail 2455 invoked by alias); 24 Jul 2005 09:33:33 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9143 Received: (qmail 2446 invoked from network); 24 Jul 2005 09:33:32 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 24 Jul 2005 09:33:32 -0000 Received: (qmail 24709 invoked from network); 24 Jul 2005 09:33:32 -0000 Received: from vms046pub.verizon.net (206.46.252.46) by a.mx.sunsite.dk with SMTP; 24 Jul 2005 09:33:29 -0000 Received: from candle.brasslantern.com ([71.116.88.149]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IK4004TVL7HIB67@vms046.mailsrvcs.net> for zsh-users@sunsite.dk; Sun, 24 Jul 2005 04:33:19 -0500 (CDT) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j6O9XGGQ020735 for ; Sun, 24 Jul 2005 02:33:17 -0700 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j6O9XFnY020734 for zsh-users@sunsite.dk; Sun, 24 Jul 2005 02:33:15 -0700 Date: Sun, 24 Jul 2005 09:33:14 +0000 From: Bart Schaefer Subject: Re: outputs of _users and _hosts to arrays In-reply-to: To: zsh-users@sunsite.dk Message-id: <1050724093315.ZM20733@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: Comments: In reply to Wataru Kagawa "outputs of _users and _hosts to arrays" (Jul 24, 4:05pm) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 On Jul 24, 4:05pm, Wataru Kagawa wrote: } } How can I add the outputs of _users and _hosts to arrays? Those are completion functions. They don't have output. They just call the compadd builtin. So look up "compadd" in the manual, and you find: -O ARRAY If this option is given, the WORDS are _not_ added to the set of possible completions. Instead, matching is done as usual and all of the WORDS given as arguments that match the string on the command line will be stored in the array parameter whose name is given as ARRAY. And therefore: _users -O users _hosts -O hosts However, that only works inside functions called by the completion code. You cannot employ _users and _hosts for generalized programming. } users=( "$_users[@]" ) } hosts=( "$_hosts[@]" ) That syntax would mean that _users and _hosts were array variables; but you seem to know that they're functions, so why did you try that?