Follow Discord
Sweep 20 Nov 2026 · 19:55Z Build v2.1.330 547 read Stable v2.1.323 Latest v2.1.330 Next v2.1.330 Feeds RSS JSON llms.txt llms-full.txt Unofficial

Claude Code v2.1.328 ·

Sandboxed Bash commands start under bash -p with stored variables cleared

Sandboxed commands now run as bash -p and clear BASH_ENV, CDPATH and PS4, unless your settings or /env set BASH_ENV, SHELLOPTS or BASHOPTS

Group of 2 Under the hood Internal Changes
JSON All of v2.1.328
Under the hoodTier: how much it should matter to you
2Useful: my rating, 1 to 5
1Signal: worth watching, 1 to 5
SandboxArea: what it touches
Internal ChangesKind: in v2.1.328,
Internal ChangesSection of the release

Unclear Whether this applies to the sandbox on every platform is not settled.

What

The sandbox is a restricted environment Claude Code can run shell commands in. When Claude Code builds a sandboxed command of the form <bash|sh> -c cmd, it now rewrites it to start bash with -p, a mode in which bash reads no start-up file:

  • The command becomes bash -p -c 'set +p; unset BASH_ENV; unset CDPATH; PS4=...; cmd', so BASH_ENV and CDPATH are removed and PS4 is reset before your command runs.
  • This is skipped, and the command is left as built, if a settings file or /env supplies a non-empty BASH_ENV, SHELLOPTS or BASHOPTS.
  • An accompanying explanation is given for each case, for example "bash is started under -p, so it takes no start-up file, functions or shell options from variables stored for the sandbox account."
  • The shell set-up snippet also gains NO_EQUALS for zsh, and is used when both shells match.

Before, the command was passed on exactly as built.

Why

Start-up files, shell functions and shell options stored for the sandbox account, possibly by another project, can no longer leak into a sandboxed command. If you rely on BASH_ENV, SHELLOPTS or BASHOPTS, setting them in settings or /env keeps the old behaviour.

How sure we are
Something disagreesSomething we can check disagrees with this entry, or the writer said they could not settle it.
The writer flagged doubtWhether this applies to the sandbox on every platform is not settled.

See this entry in the whole of v2.1.328 →

Feedback