dotenvx get --format eval-export

Return export statements for loading .env values into the current shell.

$ echo "HELLO=World" > .env
dotenvx get --format eval-export
export HELLO='World'

Evaluate the output to make the values available to subsequent commands in your current shell.

$ eval "$(dotenvx get --format=eval-export)"
echo "$HELLO"
World

Use --include-key to export only matching variables.

$ eval "$(dotenvx get -ik 'TF_VAR_*' --format=eval-export)"
terraform plan
terraform apply

The exported values remain in the current shell until you unset them or close the shell. Prefer dotenvx run -- when variables only need to be available to a single command.