Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

python in bash script

Just pass a HereDoc to python -.

From python help python -h:
-      : program read from stdin

#!/bin/bash
MYSTRING="Do something in bash"
echo $MYSTRING

python - << EOF
myPyString = "Do something on python"
print myPyString

EOF

echo "Back to bash"
Source by unix.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #python #bash #script
ADD COMMENT
Topic
Name
4+9 =