Skip to content

Instantly share code, notes, and snippets.

@bernerdschaefer
Created April 17, 2012 11:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bernerdschaefer/2405385 to your computer and use it in GitHub Desktop.
Save bernerdschaefer/2405385 to your computer and use it in GitHub Desktop.
# cat .env
# MYVAR=1
#
# with_env ruby -e "p ENV['MYVAR']" # => 1
# ruby -e "p ENV['MYVAR']" # => nil
with_env() {
env $([ -f ".env" ] && cat .env) $*
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment