Skip to content

Instantly share code, notes, and snippets.

@keenhenry
Forked from jiaaro/script.bash
Created April 16, 2016 20:04
Show Gist options
  • Save keenhenry/1408bb762fe2a4610b0967effd037fb5 to your computer and use it in GitHub Desktop.
Save keenhenry/1408bb762fe2a4610b0967effd037fb5 to your computer and use it in GitHub Desktop.
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