From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24782 invoked by alias); 7 Oct 2015 16:07:05 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36814 Received: (qmail 20157 invoked from network); 7 Oct 2015 16:07:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=9AiqDUMHJBDvlWrpfY9JY9Bz6QpjeitoSJzSUe+9wOU=; b=pS7nOTHobQWDQiLgoeourAvop/19MYxpJCM5ENDbSa9z+K2mhJD4kr+Iyk/ucXsDyw 2/gyHkekom/pENhwEyEjKkPjK6QDjW09xKO5LO7P+a0nbMTOOVoxKtWCI/u8Q8gizaTN 0RKbf7Cg4pHo18QkxsdKHAEziqvOdYzJBLz3X2V8fKMu+EgzKOkpxDK7BGKgROpnUhn2 +hSjTF0siCrvUODi4btUrwTZ8Nzmg7QnHE9cY0BW/fK+FPNMldPA+BdHq3GuK7W+tmNT 6bnly2Df77brsuXbM+1uOLe2oPiLcIETG+Y9BLUkW5HuoeTTRy2pK+fh7KBQ+0++u8tP /XYg== X-Received: by 10.25.168.16 with SMTP id r16mr702071lfe.54.1444234022625; Wed, 07 Oct 2015 09:07:02 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20151007163901.03d561ad@pwslap01u.europe.root.pri> References: <20151007163901.03d561ad@pwslap01u.europe.root.pri> From: Sebastian Gniazdowski Date: Wed, 7 Oct 2015 18:06:43 +0200 Message-ID: Subject: Re: Possible bug with $~pattern, (#mi) To: Peter Stephenson Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 True, beg wasn't set in first invocation. However pattern #(#mi)1 is correct: # a="1234"; echo ${a/#(#mi)1/-} -234 When beg is used (this time correctly): # a="1234"; beg="#"; echo ${a/$~beg(#mi)1/-} zsh: bad pattern: #(#mi)1 Best regards, Sebastian Gniazdowski On 7 October 2015 at 17:39, Peter Stephenson wrote: > On Wed, 7 Oct 2015 17:28:04 +0200 > Sebastian Gniazdowski wrote: >> first one and third one are the same, but only first invocation works. >> Not sure if second one should work: >> >> # a="1234"; beg="#" echo ${a/$~beg(#mi)1/-} >> -234 >> # a="1234"; beg="#"; num=1; echo ${a/$~beg(#mi)$~num/-} >> zsh: bad pattern: #(#mi)1 >> # a="1234"; beg="#" echo ${a/$~beg(#mi)1/-} >> zsh: bad pattern: #(#mi)1 >> # > > The difference is the first one doesn't have $beg defined at the point > where the expansion takes place, because beg is being put into the > environment to use when the command is run. The environment of the > command is not the same thing as the set of variables avaiable to the > shell for preparing the command line. > > So what you're executing that works is actually > > a="1234" > echo ${a/(#mi)1/-} > > After that, the result is self explanatory --- #(#mi) is a bad pattern > (with EXTENDED_GLOB set). > > pws