Skip to content

Instantly share code, notes, and snippets.

@mihow
Last active July 19, 2024 19:44
Show Gist options
  • Save mihow/9c7f559807069a03e302605691f85572 to your computer and use it in GitHub Desktop.
Save mihow/9c7f559807069a03e302605691f85572 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
@speedenator
Copy link

Also - recommend to use [[:space:]] rather than \s or [ \t] --- on Macs, \s isn't space, and \t isn't TAB but t. Yay standardization!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment