Re:Plan9 has been forked: 9front
by sigil on Monday July 18, 2011 @11:53AM
(#2776776)
but that command triggered a series of pipes internally, now you have to trim the status mess?
No. If you run an external command from an rc script, ie the shell is doing the fork and exec for you, then $status will have a single number just like $?.
It doesn't matter if the external command is an rc script that, internally, runs a pipeline at the end. You will only get a multi-status if the previous statement within the current rc script was a pipeline. Under sh, bash, or ksh, people rarely bother to look at $? in this situation, since it's either potentially irrelevant (without -o pipefail), or you don't know which program it's from (with -o pipefail).
so you call one command and want just to know if it failed
No. If you run an external command from an rc script, ie the shell is doing the fork and exec for you, then $status will have a single number just like $?.
It doesn't matter if the external command is an rc script that, internally, runs a pipeline at the end. You will only get a multi-status if the previous statement within the current rc script was a pipeline. Under sh, bash, or ksh, people rarely bother to look at $? in this situation, since it's either potentially irrelevant (without -o pipefail), or you don't know which program it's from (with -o pipefail).
so you call one command and want just to know if it failed
This works perfectly fine in rc:
From the rc docs:> Any $status containing only 0’s and |’s has boolean value true. Any other status is false.