Python scripts and return codes
tim_one at email.msn.com
Fri Sep 8 22:14:49 CEST 2000
> Is it possible for a Python script to send a return code back to the shell
> that's running it? Yes, I know I should be doing it all in
> Python :-), but I'm
> trying to add a Python-based util to an existing shell script (on
> a Win platform
> with a MKS Korn shell).
>>> import sys
>>> print sys.exit.__doc__
Exit the interpreter by raising SystemExit(status).
If the status is omitted or None, it defaults to zero (i.e., success).
If the status numeric, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).
So, e.g., sys.exit(5)
More information about the Python-list