script="for i in range(1,10): print(i)"
python -c """$script"""

带参数:

script="
import sys
a=sys.argv
for i in a: print(i)
"
python -c """$script""" hello bash

运行结果:

-c
hello
bash