Skip to content Skip to sidebar Skip to footer

Capturing Python Process's Exit Status In Unix Shell

I'm trying to figure out how to capture a return value from a python script in a *nix terminal. I'm using Linux. So, for clarity, I have a converter script where you pass the Pytho

Solution 1:

1. Capturing the exit status

python foo.py 111
retVal=$?

2. Capturing both the exit status and standard output

output=$(python foo.py 111)
retVal=$?

Post a Comment for "Capturing Python Process's Exit Status In Unix Shell"