On 05/30/2011 05:14 PM, fred smith wrote:
Yes, all commands return a value UNLESS it was written by one of the idi,... er, misguided programmers who thinks its ok to write (in C):
void main (void) { ... exit(); }
because, of course, in C main() always returns SOMETHING.
I'm sure it's the same in a bash script, even if the script doesn't explicitly provide a return value I imagine the shell returns something anyway, it's just that it's meaningless when that happens.
In a bash script, "exit" with no parameter and just falling off the end of the script are both equivalent to "exit $?" and return the status from the last command or shell construct executed in the script.