statusline-setup should detect user's shell and generate appropriate script

Resolved 💬 2 comments Opened Mar 4, 2026 by hpkotak Closed Apr 2, 2026

Summary

The statusline-setup agent generates a shell script (~/.claude/statusline-command.sh) with a hardcoded shebang and shell-specific syntax, without detecting the user's actual shell. This can cause silent failures or suboptimal performance when the generated script doesn't match the user's shell.

Current behavior

The generated statusline script uses shell-specific idioms tied to a single shell (e.g., #!/bin/bash or #!/bin/zsh), regardless of what shell the user is actually running.

The two shells require significantly different syntax:

| Feature | zsh | bash |
|---------|-----|------|
| Null glob | setopt NULL_GLOB | shopt -s nullglob |
| Epoch time | $EPOCHSECONDS (builtin) | date +%s (fork) |
| File stat | zstat (builtin via zmodload zsh/stat) | stat -f %m (fork) |
| Lowercase | ${(L)var} | ${var,,} |
| Module loading | zmodload zsh/stat, zmodload zsh/datetime | N/A |

Problem

  • A zsh user getting a bash-shebang script misses out on builtin performance (builtins vs forking to date/stat on every statusline refresh)
  • A bash user getting a zsh-shebang script gets outright errors (zmodload: command not found, etc.)
  • Users have to manually maintain shell-appropriate versions

Expected behavior

The statusline-setup agent should detect the user's shell and generate a script with matching syntax. Detection could use (in priority order):

  1. CLAUDE_CODE_SHELL env var (already exists for shell override)
  2. $SHELL env var
  3. Fallback to a POSIX-compatible version

Environment

  • macOS (Darwin 25.3.0), zsh
  • Discovered while setting up statusline — the agent generated a bash script on a zsh system

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗