Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 18, 2021 08:05 am GMT

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:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To