On Wed 2008-07-23 10:10:01 UTC-0000, John Matthews ([EMAIL PROTECTED]) wrote:
> Operating system dependent. An example in Linux:
>
> Program file answer.c:
>
> int main(void)
> {
> return 42;
> }
>
> Compile the program:
> > gcc answer.c -o answer
>
> Run it:
> > answer
>
> Display the program's return value:
> > echo $status
> 42
I think $status only works with csh/tcsh. You can use
echo $?
instead. This works with sh, bash and csh/tcsh.
In Windows XP (and probably Windows 2000, 2003 and Vista) the
equivalent is:
echo %ERRORLEVEL%