Possible return values for $?

I think the $? returns 0 if the last issued command was successful and otherwise if not. But does anyone knows the value list that may be returned ? (or it is only zero/one ? )

Thanks in advance,
Abrahao.

That depends on the program you have run. Return codes are usually listed in the man pages.

you can get a list from

/usr/include/sys/errno.h

the $? will return the exit code of the previous command executed....

the value depends on the success of the last command...

0 is always used to denote a success

other values depend on the type of error....

example: in a cp command if the source file is not found, it will give a non-zero erro and if destination is not found, it will give another non-zero error value... so depending on the value returned, we can find out the error occured