Reputation: 3954
I know $?
returns the last status code and also $!
.
What is the exact difference of usage between the two.
Thanks
Upvotes: 0
Views: 68
Reputation: 19298
They are different.
$!
is the process identifier of the most recent background command and
$?
is like you said, the most recent foreground pipeline exit status.
Reference point : http://tiswww.case.edu/php/chet/bash/bashref.html#SEC28
Upvotes: 2