From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29757 invoked by alias); 26 Sep 2015 17:47:38 -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: 20646 Received: (qmail 23555 invoked from network); 26 Sep 2015 17:47:38 -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=yandex.ru; s=mail; t=1443289281; bh=i6HMq8zTiQWg1a7lrrgYZ3X3fkjlQg3seiP/97O77yg=; h=From:To:Cc:In-Reply-To:References:Subject:Date; b=MWN2itNpuWd8ZYttbP/Xx3R6S4gp3+K6owOSITU+MCmr+iG8yB+f/5dM77+HZg0Tx PhvGGqhmUJBuyJHvXuItwA4OHiU5fZSj8FwyxmR2RQV6ik0p1J9FtJlcekl2694+/i VNWnw3UKM3UXHW+HM/uawBPZefOuTRqak8vxCUrA= From: ZyX To: Mikael Magnusson , Dmitri Vereshchagin Cc: Zsh Users In-Reply-To: References: <20150926101839.GA14021@gmail.com> Subject: Re: question about parameter expansion MIME-Version: 1.0 Message-Id: <187221443289280@web15m.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Sat, 26 Sep 2015 20:41:20 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=koi8-r 26.09.2015, 16:38, "Mikael Magnusson" : > On Sat, Sep 26, 2015 at 12:18 PM, Dmitri Vereshchagin > wrote: >> šHello. >> >> šHere is a code sample I would like to rewrite using parameter expansion >> >> šššif (( ${+foo} )); then >> šššššbar= >> šššelse >> šššššbar=baz >> šššfi >> >> šCannot find it in the docs, but I suppose there is a way to do that. Am >> šI right? >> >> šThanks. >> >> š-- >> šDmitri Vereshchagin > > You have to think outside the box for this one, > bar=${${${+foo}#1}//0/baz} Why not simply bar=${foo+baz} ? > > -- > Mikael Magnusson