Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Shell snapshot enables set -o monitor and set -o onecmd in every Bash tool shell (grep "on" matches option names)

Open Beginner friendly
#97,353 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bash, shell
Domain
cli

Research direction

Search the shell snapshot generation for the shown set -o | grep "on" command and inspect how Bash options are recorded. Reproduce the behavior in a clean Bash using the commands in the issue, then change the state matching so only options whose state is on are written; verify that monitor and onecmd are absent when off.

Written by the indexing model from the issue text.

Description

area:bash bug has repro
Summary

The shell snapshot captures shell options with:

set -o | grep "on" | awk '{print "set -o " $1}' | head -n 1000 >> "$SNAPSHOT_FILE"

grep "on" is meant to keep options whose state is on, but it matches the substring anywhere in the line. Two option names contain "on": monitor and onecmd. Both are written to the snapshot as set -o monitor and set -o onecmd even when they are off, so every Bash tool shell runs with job control and onecmd enabled.

This appears to be the root cause of #47689 and #19057 (see also #17534 and #16231), which report set -o onecmd in snapshots on shells where it is off.

Reproduction

In a clean bash:

$ env -i bash --norc --noprofile -c 'set -o | grep -E "^(monitor|onecmd)\s"'
monitor         off
onecmd          off

$ env -i bash --norc --noprofile -c 'set -o | grep "on" | awk "{print \"set -o \" \$1}"'
set -o braceexpand
set -o hashall
set -o interactive-comments
set -o monitor
set -o onecmd

In Claude Code, ~/.claude/shell-snapshots/snapshot-bash-*.sh contains set -o monitor and set -o onecmd, and echo $- in a Bash tool call prints hmtBc (m is monitor, t is onecmd).

Effects
  • monitor in a non-interactive shell puts each background job in its own process group, and bash prints job-status lines such as [1]+ Done sleep 0.1 into tool output.
  • onecmd: the linked issues report Bash tool calls returning no output.
Suggested fix

Match the state column instead of the substring:

set -o | awk '$2 == "on" {print "set -o " $1}' | head -n 1000 >> "$SNAPSHOT_FILE"

With this change, the clean-shell output above contains only braceexpand, hashall, and interactive-comments.

Environment
  • Claude Code 2.1.283
Dominant language
TypeScript
Stars
153k
Forks
26.7k
Avg merge
22h 37m
Merged PRs (30d)
19

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anthropics/claude-code

All issues in anthropics/claude-code

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.