Skip to content

Conversation

@marushomurai
Copy link

Summary

  • Change #!/bin/bash to #!/usr/bin/env bash in setup-ralph-loop.sh and stop-hook.sh
  • Fixes crash on macOS where /bin/bash is Bash 3.2 (GPLv2), which treats empty arrays as "unbound variable" under set -u

Problem

macOS ships with Bash 3.2.57 at /bin/bash (Apple refuses to ship GPLv3-licensed Bash 4+). This version has a known bug:

set -euo pipefail
ARR=()
echo "${ARR[*]}"  # → "unbound variable" error on Bash 3.2
                   # → works fine on Bash 4.4+

setup-ralph-loop.sh line 113 hits this exact issue when PROMPT_PARTS is empty, causing:

PROMPT_PARTS[*]: unbound variable

Fix

Using #!/usr/bin/env bash resolves the PATH to a modern Bash (e.g. Homebrew's Bash 5.x) when available. This is consistent with the approach already used by explanatory-output-style and learning-output-style hooks in this repo.

Test plan

  • Verified on macOS (Bash 3.2 → Bash 5.3.9 via Homebrew)
  • setup-ralph-loop.sh with no arguments: shows proper error message instead of crashing
  • setup-ralph-loop.sh with arguments: activates loop correctly
  • No behavior change on Linux (where /bin/bash is already 5.x)

🤖 Generated with Claude Code

macOS ships with Bash 3.2 (GPLv2) at /bin/bash, which has a known
issue where empty arrays cause "unbound variable" errors under set -u.
This breaks setup-ralph-loop.sh on line 113 when PROMPT_PARTS is empty.

Using #!/usr/bin/env bash allows the scripts to pick up a modern Bash
(e.g. Homebrew's Bash 5.x) from PATH, consistent with the approach
already used by explanatory-output-style and learning-output-style.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Thanks for your interest! This repo only accepts contributions from Anthropic team members. If you'd like to submit a plugin to the marketplace, please submit your plugin here.

@github-actions github-actions bot closed this Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant