[prev in list] [next in list] [prev in thread] [next in thread]
List: centos
Subject: Re: [CentOS] Getting the return value of the last command run
From: Robert Nichols <rnicholsNOSPAM () comcast ! net>
Date: 2011-05-31 1:24:53
Message-ID: is1g16$lhq$1 () dough ! gmane ! org
[Download RAW message or body]
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.
--
Bob Nichols "NOSPAM" is really part of my email address.
Do NOT delete it.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic