An Interest In:
Web News this Week
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
July 18, 2021 08:05 am GMT
Original Link: https://dev.to/abdennour/populate-env-vars-from-env-file-with-shell-2338
Populate env vars from .env file with Shell
This should work
export $(cat .env | xargs)
But not all time namely if it includes some comments and you are running it with sh (not bash)
Then, mitigate this issue by using instead:
export $(cat .env | sed 's@#.*@@'| tr -d '' | xargs)
Original Link: https://dev.to/abdennour/populate-env-vars-from-env-file-with-shell-2338
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To