Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Embed Python in a bash script
#!/bin/bash
export FOO=100
python - <<END
import os
print "foo:", os.environ['FOO']
END
BAR=200 python - <<END
import os
print "bar:", os.environ['BAR']
END
# output:
# foo: 100
# bar: 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.