Skip to content

Instantly share code, notes, and snippets.

@mihow
Last active May 22, 2024 06:50
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
@MansourM
Copy link

MansourM commented Apr 27, 2024

Looks great, but it doesn't work if the .env file contains only 1 row (just one without br)

how do you use it?
you get any errors?
btw u need to comment or remove this line as you don't have the log function
log "Reading $filePath"

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