My pythonscript looks like this
#!/usr/bin/python3
#File Name: pythonScript.py
from sys import exit
if '__name__'=='__main__':exit(402)
And this is the shell script
python3 pythonScript.py
echo $?
It prints 146. How does 402 get mapped to 146? Some other pairs such as this are (402, 146), (100,0), (0, 0), (56, 0) etc.
Can the python script return value to shell this way, and is the ?
the correct variable to capture this?
My machine version is this, if this is important.
4.4.0-89-generic #112-Ubuntu SMP Mon Jul 31 19:38:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux