xxxxxxxxxx
# env file should not have spaces
source .env
# or
export $(xargs <.env)
# can work with .env with spaces, but needs to be valid shell
set -a # automatically export all variables
source .env
set +a
# this works even for invalid shell
while IFS== read -r key value; do
printf -v "$key" %s "$value" && export "$key"
done <.env