Skip to content

Instantly share code, notes, and snippets.

@jiaaro
Created April 24, 2013 14:45
Show Gist options
  • Save jiaaro/5452675 to your computer and use it in GitHub Desktop.
Save jiaaro/5452675 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