From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Thu, 21 Mar 2013 11:27:15 -0400 To: 9fans@9fans.net Message-ID: <7951e6b417d53eed0e3f8cecb0d74e7b@ladd.quanstro.net> In-Reply-To: <30310135.BKH1Es4pAj@coil> References: <2197990.tSQfKsnBKJ@coil> <4e493d5761cf93be80cc94d97d57c7ea@brasstown.quanstro.net> <30310135.BKH1Es4pAj@coil> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] p9p rc flag e + Topicbox-Message-UUID: 2ff1e4b4-ead8-11e9-9d60-3106f5b1d025 > i'd rather have if's $status visible only to the first statement following it, > for example: > > if (foo | bar | baz) { # sets $status > if (! ~ $status ....) { # uses $status > handle_particular_kind_of_pipeline_failure > } > do_other_stuff # should not be affected > } > do_yet_other_stuff # should not be affected either > > > ...but guess rc's semantics are almost set in stone by now :-) the status is only visible to the first *executed* statement. remember, rc at heart is a virtual machine. since the argument of if is always executed before the branch, the status of cmd1 in "if(cond)cmd1" is by definition ''. to take this to its logical conclusion, consider this code if(~ 0 1){ } if not{ } echo $status it prints "no match". - erik