From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18868 invoked by alias); 26 Sep 2015 18:33:59 -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: 20649 Received: (qmail 9412 invoked from network); 26 Sep 2015 18:33:58 -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:date:message-id:subject:from:to :content-type; bh=YMspfD7GoFHwYxa4st3lsDLFkHW5XIK8JNfBbjtHPkE=; b=fYVDh7bpM67f2y/oi5EFC6boeQwBfkCr8tjNk8U4f304CAqR77ezprsyS47kDtPrbq RaWv4kHunAQnnxez4LrlKutdVe3+n/lGXM5E1cyHA1R6y1cuuVvALncuLRtWO/Ho2Rhn pMxWDozNNf+361mdQ3wDCy3iov40mDpkvbwqjnmJoV1PZCaEptKVlRPfX9y/5G01LtBc kJPMHkMaBmPEnQR6BW2vSSKa3EBAPPyKfvSf4hDm/3Z/J5rEbmzn4hNC1CBbXX3oBUH6 U+XobRhrMndjJCgSRHzLop0qIIJIFja7uXbEY02jFhl4EnjtRk2+uxcfM2/j2D7Jr3+R yt2Q== MIME-Version: 1.0 X-Received: by 10.55.25.94 with SMTP id k91mr13396326qkh.51.1443292437183; Sat, 26 Sep 2015 11:33:57 -0700 (PDT) In-Reply-To: <20150926180827.GA2617@gmail.com> References: <20150926101839.GA14021@gmail.com> <20150926180827.GA2617@gmail.com> Date: Sat, 26 Sep 2015 20:33:57 +0200 Message-ID: Subject: Re: question about parameter expansion From: Mikael Magnusson To: Zsh Users Content-Type: text/plain; charset=UTF-8 On Sat, Sep 26, 2015 at 8:08 PM, Dmitri Vereshchagin wrote: > * Mikael Magnusson [2015-09-26 16:37]: >> You have to think outside the box for this one, >> bar=${${${+foo}#1}//0/baz} > > I thought that there is more concise way like some sort of ${name+word} > counterpart. Thank you. Here's another variant, which may or may not be considered more concise (it happens to be the exact same number of characters, but uses fewer things, and probably doesn't work under ksh_arrays, but then, what does, commas abounds), bar=${${:-baz}[1,$+foo-1]} -- Mikael Magnusson