Bug
/ralph-loop:ralph-loop called without arguments crashes with:
setup-ralph-loop.sh: line 113: PROMPT_PARTS[*]: unbound variable
Root Cause
Line 6 sets set -euo pipefail. The -u (nounset) flag treats empty bash arrays as unbound variables.
Line 9 initializes PROMPT_PARTS=() as empty, and line 113 references ${PROMPT_PARTS[*]} which fails under set -u when no arguments were provided.
The script never reaches the helpful "No prompt provided" error message at line 116-128.
Fix
Line 113 — change:
PROMPT="${PROMPT_PARTS[*]}"
to:
PROMPT="${PROMPT_PARTS[*]:-}"
The :- provides a default empty string when the array is empty/unbound, allowing execution to reach the proper error handling block.
Reproduction
bash scripts/setup-ralph-loop.sh
# Expected: "No prompt provided" error with usage examples
# Actual: "PROMPT_PARTS[*]: unbound variable" crash
Environment
- macOS (Darwin 25.3.0)
- bash 3.2.57 (Apple default)
- Claude Code 2.1.32