From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15067 invoked by alias); 9 Mar 2012 22:50:24 -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: 30336 Received: (qmail 12550 invoked from network); 9 Mar 2012 22:50:20 -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=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.161.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=aQZ2cEIy0ji4Xn5nPkTY9XLSJkmX8ZjSgVFFGKqjqvA=; b=hBErvkKVR4ENE4ZSoubHe/dJOhs4MBeZigDSMlXwnbii3XkilbGnTIc6qINV07/FrZ J7sQdrvGwIjPf8aPY6XcFPe0lLtwtaRRY/KRubQJ0npZlXpo4Xtzllc/x6dHcEpxFUx4 TN2RvwVtrWepXLgrloMoUoSlU3gaDgE5tXavTOJvswMAIOl4VqpavAZEDMj+VQLEDKP2 Yg3hFEFWChUQI8Y+ttapr5kswR/LhNpYZ9YJHOpUDWPjGee9lD8KdQHzt0ZtqLxXoX7N 7e2bWc+5zBNdo0PRiEXfeRMrKQZ1hN6fVPPfKr709bc60zy5SsOiMWtl+sAnVbOPX7BS 60rQ== MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 9 Mar 2012 23:25:25 +0100 Message-ID: Subject: Re: parameter expansion, substitution From: Mikael Magnusson To: "S. Cowles" Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 On 9 March 2012 23:03, S. Cowles wrote: > i am not getting expected results in the following code snippet: > b="abc" ; b=${b/#abc%/d} ; echo ${b} > i expect the value of b to be changed to "d"; however, it remains "abc". > > the following snippet does give the expected result: > b="abc" ; b=${b/#abc/d} ; echo ${b} > > for this session, the following shell options are set: interactive monitor > shinstdin zle. the version of the shell being used is 4.3.17-dev-0, > patchlevel 1.5604. > > in my use case, i need to specify a pattern match at the end of the > parameter. have i misunderstood the syntax of the '%' end-of-string > operator? or is this problem something else? > > thanks for any help. It's possibly a bit counterintuitive, but both # and % go at the start of the string, so you want b=${b/#%abc/d} -- Mikael Magnusson