Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

docs(cli): document dotenv-eval export format

Claude4af02175dcef
diff --git a/docs/cli/commands/export.mdx b/docs/cli/commands/export.mdx
index d5b5d6352b..08c1f39ed9 100644
--- a/docs/cli/commands/export.mdx
+++ b/docs/cli/commands/export.mdx
@@ -27,6 +27,10 @@ infisical export --output-file=./.env
infisical export --format=dotenv-export > .env
infisical export --format=dotenv-export --output-file=./.env
+# Export variables for shell eval/source (POSIX shell-quoted, safe for eval)
+eval "$(infisical export --format=dotenv-eval)"
+infisical export --format=dotenv-eval --output-file=./.env
+
# Export variables to a JSON file
infisical export --format=json > secrets.json
infisical export --format=json --output-file=./secrets.json
@@ -169,10 +173,23 @@ infisical export --template=<path to template>
</Accordion>
<Accordion title="--format">
- Format of the output file. Accepted values: `dotenv`, `dotenv-export`, `csv`, `json` and `yaml`
+ Format of the output file. Accepted values: `dotenv`, `dotenv-export`, `dotenv-eval`, `csv`, `json` and `yaml`
Default value: `dotenv`
+ The `dotenv-eval` format emits each secret as an `export KEY='value'` statement with values POSIX shell-quoted (wrapped in single quotes, with embedded single quotes escaped). This makes the output safe to load directly into your current shell via `eval`/`source`, regardless of the value's contents (newlines, single quotes, `$`, `"`, `\`, and other shell metacharacters are preserved verbatim).
+
+ ```bash
+ # Load secrets into the current shell session
+ eval "$(infisical export --format=dotenv-eval)"
+ ```
+
+ ```bash
+ # Example output
+ export DATABASE_URL='postgres://user:pass@localhost:5432/db'
+ export API_KEY='it'\''s a secret'
+ ```
+
</Accordion>
<Accordion title="--secret-overriding">