From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22895 invoked by alias); 2 Mar 2015 11:16:21 -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: 19953 Received: (qmail 21218 invoked from network); 2 Mar 2015 11:16:19 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7fc86d0000066b7-89-54f44390c90f Date: Mon, 02 Mar 2015 11:06:10 +0000 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: grammar triviality with '&&' Message-id: <20150302110610.2e2c7e86@pwslap01u.europe.root.pri> In-reply-to: <20150302104619.GC6869@xvii.vinc17.org> References: <54F33934.2070607@eastlink.ca> <13666281425228233@web7o.yandex.ru> <54F345D3.9010204@eastlink.ca> <20150302022754.GA7449@xvii.vinc17.org> <20150302104619.GC6869@xvii.vinc17.org> 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+NgFlrCLMWRmVeSWpSXmKPExsVy+t/xq7oTnL+EGNxcz26x4+RKRgdGj1UH PzAFMEZx2aSk5mSWpRbp2yVwZdxc85GtoI+j4v1V7gbGfrYuRk4OCQETidkrpjFC2GISF+6t B4pzcQgJLGWUeLi9FcpZxCTxY8sKFghnG6PEnolrWbsYOThYBFQlps9yBelmEzCUmLppNtgk EQFRieUrNrOD2MICmhLLPnxmAynnFbCX2HxcAyTMCbR4/t7FUPP3MknsnfUG7CJ+AX2Jq38/ MUFcZC8x88oZsJm8AoISPybfYwGxmQW0JDZva2KFsOUlNq95ywxiCwmoS9y4u5t9AqPQLCQt s5C0zELSsoCReRWjaGppckFxUnqukV5xYm5xaV66XnJ+7iZGSMh+3cG49JjVIUYBDkYlHt4T Bz+HCLEmlhVX5h5ilOBgVhLhfS3/JUSINyWxsiq1KD++qDQntfgQIxMHp1QDIx/vZp7at/y9 f04wPNiq235Axru9VfGUwJzwmbXmReed6h3qevaePxWvZryqPq1Q0tPCtXql6+vtOUqv13T6 Kp9PY3418V3Kdtdrbz/0CvWUbQuLlmpxXOplcFHV9cdejp5pq8NXxbNKfnDu3TdhVXeosMuF YoYC85fmcXvUtunrifz7IHxciaU4I9FQi7moOBEAixBcRDcCAAA= On Mon, 2 Mar 2015 11:46:19 +0100 Vincent Lefevre wrote: > Now, assume that as soon as some command fails, you don't want > to execute the following ones, but you still want to have the > 3 commands in the history when invoking the latest cmd1 by a > history search (something I often do). Currently, the only way > to do that is, AFAIK: > > cmd1 > [[ $? -eq 0 ]] && cmd2 > [[ $? -eq 0 ]] && cmd3 > > But having > > cmd1 > && cmd2 > && cmd3 > > could be nicer (I would also like the fact that one can easier see > that these 3 commands are related). % andfn() { integer stat=$? (( $stat > 0 )) && return $stat return 0 } % alias and='andfn &&' % print this worked this worked % and print so did this so did this % and { print but this failed; false; } but this failed % and print so this didn\'t get printed -- Peter Stephenson | Principal Engineer Samsung Cambridge Solution Centre Email: p.stephenson@samsung.com | Phone: +44 1223 434724 | www.samsung.com