Skip to content

Instantly share code, notes, and snippets.

@cicorias
Forked from mihow/load_dotenv.sh
Last active February 15, 2022 14:56
Show Gist options
  • Save cicorias/9bc1cebe666c9dba7aa3679c1381f8bf to your computer and use it in GitHub Desktop.
Save cicorias/9bc1cebe666c9dba7aa3679c1381f8bf to your computer and use it in GitHub Desktop.
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
# or
set -o allexport
source .env
set +o allexport
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment