Skip to content

Instantly share code, notes, and snippets.

@jeremygaither
Forked from judy2k/parse_dotenv.bash
Created August 23, 2017 22:17
Show Gist options
  • Save jeremygaither/1bab8f20e663eb0ed0ee22c03b35cbcc to your computer and use it in GitHub Desktop.
Save jeremygaither/1bab8f20e663eb0ed0ee22c03b35cbcc to your computer and use it in GitHub Desktop.
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment