Skip to content

Instantly share code, notes, and snippets.

@joseluisq
Forked from mihow/load_dotenv.sh
Last active February 25, 2020 10:55
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 joseluisq/ffd42d8d9b9e33cba509b689411b5662 to your computer and use it in GitHub Desktop.
Save joseluisq/ffd42d8d9b9e33cba509b689411b5662 to your computer and use it in GitHub Desktop.
Load environment variables from a .env file from a Bash shell script
#!/usr/bin/env bash
set -e
set -u
if [ -f .env ]; then
export $(cat .env | xargs)
else
echo ".env file not found"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment