tags:

views:

359

answers:

1

How to find the return value of last executed command in UNIX?

+6  A: 

You can use the shell valiable "$?" (without the quotes, of course).

Such as:

ghostdog$ true ; echo $?
0
ghostdog$ false ; echo $?
1
ghostdog74
The answer includes the question mark.
GreenReign
Clarified, added an example and upvoted.
paxdiablo