bash - exit status in shell script -
I am running an application form shell script now I know that it is usually out of or unusual (accident etc) Wants to know the exit status of the application to get out. How do I know this? Example: ./mytestApp
All of this assumes that you bash (sh and zsh will also work as IIRC). $? In the the last out-of-order command is executed. Therefore, if the last command is
./ mytestapp ,
$? will immediately include the situation outside of it (note that you can only recover this value once and it should be re-instantly received, after which the condition of the command you want to know). You might want to capture it in a variable, eg
#! / Bin / bash ./mytestappappspcc = $? Continue what you are doing
Comments
Post a Comment