dotenvx get --format shell
Return a shell formatted response of all key/value pairs in a .env file.
$ echo "HELLO=World" > .env
echo "KEY=value" >> .env
dotenvx get --format shell
HELLO=World KEY=value
This can be useful when combined with env on the command line.
$ echo "console.log('Hello ' + process.env.KEY + ' ' + process.env.HELLO)" > index.js
env $(dotenvx get --format=shell) node index.js
Hello value World
or with export.
$ echo "console.log('Hello ' + process.env.KEY + ' ' + process.env.HELLO)" > index.js
export $(dotenvx get --format=shell)
node index.js
Hello value World