Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@erick-otenyo
Forked from judy2k/parse_dotenv.bash
Created January 28, 2021 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erick-otenyo/a0c69b6dde8ddb70e6a85ae7c8a0041b to your computer and use it in GitHub Desktop.
Save erick-otenyo/a0c69b6dde8ddb70e6a85ae7c8a0041b 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