get-dotenv executes commands via execa and normalizes shell behavior across platforms.
--shell (or shell: true): use a normalized default shell
/bin/bashpowershell.exe--shell <string>: use the provided shell (e.g., /bin/zsh)--shell-off (or shell: false): execute without a shell (plain execa)shell to override the global setting for that script.Use the default shell:
getdotenv -- env VAR=1
Disable shell parsing entirely:
getdotenv --shell-off cmd echo hello
Force a specific shell:
getdotenv --shell /bin/zsh cmd 'echo "quoted with zsh"'
Script-level shell override (example getdotenv.config.json):
{
"scripts": {
"bash-only": { "cmd": "echo $SHELL && echo OK", "shell": "/bin/bash" },
"plain": { "cmd": "node -v", "shell": false }
}
}
Then:
getdotenv cmd bash-only
getdotenv cmd plain
$ for literal dollar signs.Nested getdotenv invocations inherit parent CLI options and the loaded dotenv context via process.env.getDotenvCliOptions (JSON). The shell resolution and scripts table continue to apply within nested commands using the same rules.
Child processes receive a normalized environment composed from the parent and the current dotenv context:
{ ...process.env, ...ctx.dotenv }By default, child process output is streamed live (stdio: 'inherit'). For deterministic logs in CI or tests, enable capture:
--captureGETDOTENV_STDIO=pipeWhen capture is enabled, stdout/stderr are buffered and re‑emitted after the child completes. Batch and AWS forwarding also honor capture, ensuring stable output ordering in automated environments. Live streaming remains available by omitting the flag/env (the default).