From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1527 invoked by alias); 30 Jan 2016 07:47:08 -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: 37842 Received: (qmail 11677 invoked from network); 30 Jan 2016 07:47:05 -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,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=c8rHQBiefimjiaTLmI5ch65pyCg=; b=y2+UPF IfEFB2CdRkzuIB1T3ZOz1eS5iGdlfkzZfuMPJ42gtwrsRo4L8aoCiWTedR1D43Pg UpCfAv42PfD1Cp2ugXAmlgNdXtfufyUYZNG2dw2SeuOpFQ2Tpvc5fKUX1Yw/WsLO qkR4A4H2cBW2ORyjQLdX4YQXd3p/0eq/bCGXw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=c8rHQBiefimjiaTLmI5ch65pyCg=; b=GA/wv kStgnG4fJMkCCI/ZJsMcj+XQihBT8W92OHC1LqWiumBOtCsjbXL/6iPoK5ZH4qYJ ujyHmsR5F3JbMz/qLRJaiO5fZ7ydgkj9hHGsBMeAaTUjpHULfj43mG3i12C3Y+4u GexIrp/vRQW+xtHiLDqePxt2qUciyLJwO2Oohs= X-Sasl-enc: WgMYbg01H4nk6ubEmH4ZV0URt/nFYUDudkdNRPA30inH 1454140022 Date: Sat, 30 Jan 2016 07:46:57 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: typeset docs flow Re: [PATCH] typeset: set $? on incidental error Message-ID: <20160130074657.GA3030@tarsus.local2> References: <20160123235300.GC20278@tarsus.local2> <56A445E0.50706@gmx.com> <20160126225008.GA4731@tarsus.local2> <160126201724.ZM2552@torch.brasslantern.com> <20160129091834.GA8420@tarsus.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160129091834.GA8420@tarsus.local2> User-Agent: Mutt/1.5.21 (2010-09-15) Daniel Shahaf wrote on Fri, Jan 29, 2016 at 09:18:34 +0000: > diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo > index fb630a7..6e3d146 100644 > --- a/Doc/Zsh/builtins.yo > +++ b/Doc/Zsh/builtins.yo > @@ -1826,6 +1826,23 @@ reserved word interface for tt(typeset) may cause problems with the > output of `tt(typeset -p)', which assumes the reserved word interface is > available in order to restore array and associative array values. > > +Unlike parameter assignment statements, tt(typeset)'s exit status on an > +assignment that involves a command substitution does not reflect the exit > +status of the command substitution. Therefore, to test for an error in > +a command substitution, separate the declaration of the parameter from its > +initialization: > + > +example(# WRONG > +typeset var1=$(exit 1) || echo "Trouble with var1" > + > +# RIGHT > +typeset var1 && var1=$(exit 1) || echo "Trouble with var1" > +) > + > +To initialize a parameter var(param) to a command output and mark it readonly, > +use tt(typeset -r )var(param) or tt(readonly )var(param) after the parameter > +assignment statement. > + The following paragraph (the context lines of the patch) is the continuation of the text about var(name) that precedes the segment about the reserved word syntax. The fix is probably to move the whole reserved words chunk to right before the startitem() of the control flags? I'd fix that but I'm short on time at the moment and don't want to do a rush job of it. Daniel > If the shell option tt(TYPESET_SILENT) is not set, for each remaining > var(name) that refers to a parameter that is already set, the name and > value of the parameter are printed in the form of an assignment.