I have a process that just finished (it was written in C) so I return a number in main to tell the status. How can I get this value from the process that just finished in the shell?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try using
echo $?directly after you run your command:If you are trying to base a decision on the success of your command, you can use
&&:if you are trying to base a decision on the failure of your command, you can use
||:These two things are sometimes called “short circuiting”