The $? is called exit code of an application used to run. As an example type following commands in console: top then press CTRL-Z and then type: echo $? You will see 147 as the answer. Return values more than 128 usually means signal and you have to do the calculation by subtracting 128 from…