exitstatus

Bourne Shell: Graceful way to get exit status

Is there a more graceful way to do this (bourne shell)? IsThereAnyApplesLeft applesLeft=$? Normally in c or java I would do: applesLeft=IsThereAnyApplesLeft ...

Bourne: if statement testing exit status

What is the difference: if IsServerStarted ; then ... and if [ IsServerStarted -eq 0 ] ; then ... Seems to me that these two statements should be equivalent? Strangely the second statement is always true. ...

unix shell, getting exit code with piped child

Let's say I do this in a unix shell $ some-script.sh | grep mytext $ echo $? this will give me the exit code of grep but how can I get the exit code of some-script.sh EDIT Assume that the pipe operation is immutable. ie, I can not break it apart and run the two commands seperately ...