From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20609 invoked by alias); 1 Apr 2015 15:48:22 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20063 Received: (qmail 14430 invoked from network); 1 Apr 2015 15:48:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=Q/SwQu4Z1dG0HT+GPCzuU5DNUJgdGXbGy/ZRyYi5B50=; b=EsQOepOkK91kzXEo1uinysZ3uAa30qw5Juf3LFQvWa3jWoGS4LwviAUeWJjSujhYjs kCsHFiXXw7sU3Ia4gpcUfCikH3ybq37/dbwrXc4IszGSNuPcm0HPvdTEXAT81e0NgOWJ WiCXzWu6YkVd8Puh6paWWSJdGmyvbbdyRykRaFsFBFYx0e5ATTyFZJmp5QdTeGQljxUg OjvZh+SxbQIJerIEA4Oz1p2SgVuk29R2CKwY1j9+liwVujN1FHfBlqCew5me5TIk8jwm lJzhbTguwL4XqrgutQIHFgNAoohTAFJfIDkzVMfz6JXfoDToyxGXxXkEpSWin9VRnZzg gD9w== X-Gm-Message-State: ALoCoQmAeEP3E4GDMoUzT1D73kBDcXv4VtGc8JjEHUrmYXpX5Rr70e8dH0bERCuvkn3ntJttoq97 X-Received: by 10.60.103.234 with SMTP id fz10mr7325141oeb.11.1427903267665; Wed, 01 Apr 2015 08:47:47 -0700 (PDT) From: Bart Schaefer Message-Id: <150401084744.ZM30889@torch.brasslantern.com> Date: Wed, 1 Apr 2015 08:47:44 -0700 In-Reply-To: <20150401131525.69d06918@pwslap01u.europe.root.pri> Comments: In reply to Peter Stephenson "Re: device cannot be completed after "ip link show dev"" (Apr 1, 1:15pm) References: <20150330033930.GB2856@localhost.localdomain> <20150331195701.4bc78e7c@ntlworld.com> <20150401100718.GB2805@localhost.localdomain> <20150401131525.69d06918@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: device cannot be completed after "ip link show dev" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Apr 1, 1:15pm, Peter Stephenson wrote: } } > And I have figured out this works: } > } > subcmd_dev=( } > /$'[[:alnum:][:punct:][:cntrl:][:digit:]]##\0'/ } > -'if [[ $words[CURRENT-1] = dev ]];then false;else true;fi' } > ':interfaces:network interface:_net_interfaces' } > ) } } I didn't even know what format guards could take in general... They're just passed to "eval" and the exit status checked. If false, the pattern is presumed not to match. The pattern is evaluated with backreferences enabled, so normally you'd refer to $match in the guard, but in this case maybe we want to examine previous words rather than the one to which the pattern is being applied. subcmd_dev=( /$'[[:alnum:][:punct:][:cntrl:][:digit:]]##\0'/ -'[[ $words[CURRENT-1] != dev ]]' ':interfaces:network interface:_net_interfaces' ) should be equivalent, but I suspect we might really want to examine the whole array slice $words[2,CURRENT-1] to see if "dev" appears anywhere.