[CentOS] Getting the return value of the last command run

Mon May 30 22:17:08 UTC 2011
Dotan Cohen <dotancohen at gmail.com>

On Tue, May 31, 2011 at 01:14, fred smith <fredex at fcshome.stoneham.ma.us> 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.
>

I also learned in C that main should be an int. Now that I'm studying
Java, main is always a void and nobody has been able to explain to me
why.

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com