From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10459 invoked by alias); 7 Oct 2015 15:40:01 -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: 36812 Received: (qmail 6496 invoked from network); 7 Oct 2015 15:40:00 -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 autolearn=ham autolearn_force=no version=3.4.0 X-AuditID: cbfec7f4-f79c56d0000012ee-08-56153cccfe21 Date: Wed, 07 Oct 2015 16:39:01 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Possible bug with $~pattern, (#mi) Message-id: <20151007163901.03d561ad@pwslap01u.europe.root.pri> In-reply-to: References: Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrELMWRmVeSWpSXmKPExsVy+t/xq7pnbETDDPY8lrY42PyQyYHRY9XB D0wBjFFcNimpOZllqUX6dglcGT9utTAXbGavWLFoKksD4xfWLkZODgkBE4nLl8+zQNhiEhfu rWfrYuTiEBJYyiix6NcpdghnBpPEoi/foTJbGSUO7GtmB2lhEVCV+DPtMxuIzSZgKDF102xG EFtEQFzi7FqIscIC+hLLNl8Es3kF7CWae5cydzFycHAKBEvMfpwEYgoJBEjsbqkFqeAHqr76 9xMTxEH2EjOvnGGE6BSU+DH5HtgUZgEtic3bmlghbHmJzWveMoPYQgLqEjfu7mafwCg0C0nL LCQts5C0LGBkXsUomlqaXFCclJ5rqFecmFtcmpeul5yfu4kRErJfdjAuPmZ1iFGAg1GJh/eH sUiYEGtiWXFl7iFGCQ5mJRFeMQvRMCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8c3e9DxESSE8s Sc1OTS1ILYLJMnFwSjUw8rwWsBZ+xGB79va+iXUCERf5mdZc3z/FQuf8y5iA94ta+Q65lS6S ivcMeMaQfnJDVvs+twy1V49fp/c1a281lZnImWq4JK7k6Zl6x+XXM+R9T8+VV1ANrHyWabZ7 t9kNlngNt+qH+2qMH4Xt25ym5aUpom8Xyavw3F2F5erEvs25nOn1eteUWIozEg21mIuKEwFZ +aeFVQIAAA== 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