@karmaniverous/get-dotenv
    Preparing search index...

    Shell execution behavior

    get-dotenv executes commands via execa and normalizes shell behavior across platforms.

    • --shell (or shell: true): use a normalized default shell
      • POSIX: /bin/bash
      • Windows: powershell.exe
    • --shell <string>: use the provided shell (e.g., /bin/zsh)
    • --shell-off (or shell: false): execute without a shell (plain execa)
    • Scripts table overrides: an individual script may specify shell to override the global setting for that script.
    • Plain (no shell): safer for simple commands; execa parses arguments as JS. Pipes, redirects, and globbing are not available unless the command itself implements them.
    • Shell mode: the specified shell parses the command string, enabling pipes, redirects, aliases, and shell builtins. Quoting and escaping must follow the shell’s rules.

    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
    • POSIX shells: prefer single quotes when possible; escape $ for literal dollar signs.
    • PowerShell: double-quotes perform interpolation; single quotes are literal.

    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.

    By default, child process output is streamed live (stdio: 'inherit'). For deterministic logs in CI or tests, enable capture:

    • Flag: --capture
    • Env: GETDOTENV_STDIO=pipe

    When 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).