> #!/usr/local/plan9/bin/9 rc > echo first at path: $path(1) > for (i in `{seq 1 5}){ > if (test $i -eq 3) { > echo $i equals 3 > } > if not echo $i is different from 3 > }
NB: in general, you don't need 'test'. use "if (~ $i 3) {}". that said, now I'm convinced there's a bug somewhere. I got your code to fail under the condition that rc is started via the '9' environment (9 rc). the type of 'test' binary doesn't matter -- both /bin/test and $PLAN9/bin/test break under '9', but don't break without it. the '9' script is pretty simple, but there appear do be some side-effects (probably due to \r being transmitted over the network?). here's the simplest version of your script: $ cat t.rc #!/usr/bin/env rc exec rc $ dial and test: $ dial -e 'tcp!localhost!8080' ######## no breakage /bin/test 1 -eq 2 ; echo $status 1 /bin/test 1 -eq 1; echo $status /Users/andrey/plan9/bin/test 1 -eq 2; echo $status 1 /Users/andrey/plan9/bin/test 1 -eq 1; echo $status ######## now see it break 9 rc /bin/test 1 -eq 2 ; echo $status /bin/test 1 -eq 1; echo $status /Users/andrey/plan9/bin/test 1 -eq 2; echo $status /Users/andrey/plan9/bin/test 1 -eq 1; echo $status ls | wc > /dev/null; echo $status | ls | wc > /dev/null; echo $status ||| ls | wc > /dev/null; echo $status ||||||| ls | wc > /dev/null; echo $status ||||||||||||||| ls | wc > /dev/null; echo $status ||||||||||||||||||||||||||||||| #####back to non-breaking rc: exit echo $status ls | wc > /dev/null; echo $status | ls | wc > /dev/null; echo $status | ls | wc > /dev/null; echo $status | ls | wc > /dev/null; echo $status | ls | wc > /dev/null; echo $status |