This question already has an answer here:
- How to export variables from a file? 2 answers
I want to have a file (outside of git) that contains certain environment variables. While a script (which is in git) needs to read them and export to
My current implementation works for variables if the value does not contain spaces. Does anyone have an idea on how to fix this?
export $(cat .env | grep -v ^# | xargs -n 1)
My file looks like this:
ALLOWED_HOSTS="127.0.0.1 dev.local localhost boot2docker"
While my environment only contains:
Note: I found a similar question: Set Variable Environment Variables in bash (or other). However those answers don't seem to understand spaces in values either.