I have two scripts: Python:
if canceled==True:
os.environ["c"] = "0"
if canceled==False:
os.environ["c"] = "1"
Bash:
kill_jobs()
{
pkill -TERM -P "$BASHPID"
echo $c
if [ $c == "0" ]
then
echo -e "OPERATIONS CANCELED"
elif [ $c == "1" ]
then
echo -e "OPERATIONS FINISHED"
fi
}
trap kill_jobs EXIT
How can I do to pass a python variable to bash script ? (My level in bash is near to 0 ...) Thanks
Edit: Now I have this error: (in french)
[: == : opérateur unaire attendu
asked May 28, 2014 at 7:30
Guillaume
2,9466 gold badges31 silver badges43 bronze badges
2 Answers 2
answered May 28, 2014 at 7:38
PradyJord
2,16013 silver badges19 bronze badges
Sign up to request clarification or add additional context in comments.
The python script should end with:
print c
Then you use it in bash with:
c=$(python_script)
answered May 28, 2014 at 7:35
Barmar
789k57 gold badges555 silver badges669 bronze badges
default