On Thursday 21 of March 2013 10:22:54 erik quanstrom wrote:
> the more idiomatic way to write this is if(~ 0 1); plan 9 has no
> /bin/false.  plan 9 rc behaves in the same way, and the usual
> solution is to use ~ 0 0 to clear the status, or exit ''.
> 
> i have seen scripts reuse the status, especially of a pipe
> inside the if.  (obviously the status is the same in either
> branch.)


thanks Erik, it makes sense to me now :-)


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 :-)


cheers,
-- 
dexen deVries

[[[↓][→]]]




Reply via email to