shell - How to pass an error exit code from a python script to the KSH script that calls it? -
i have python script called korn shell script. if python script runs error, korn shell script still exits 0. how python script tell ksh didn't terminate correctly? the rapper script looks this: python2.7 python_script.py ${inargument} >> ${log_file} 2>&1 exit_code=$? if [ ${exit_code} -ne 0 ] echo "python script failed" >> ${log_file} fi i'm not sure ksh, how python return non-zero return value, assume ksh can detect , deal that. import sys retcode = 5 sys.exit(retcode) or retcode = -128 raise systemexit(retcode)