-
Notifications
You must be signed in to change notification settings - Fork 882
Description
Bug
/ralph-loop fails immediately with:
setup-ralph-loop.sh: line 113: PROMPT_PARTS[*]: unbound variable
Root Cause
The script uses #!/bin/bash which on macOS resolves to /bin/bash (bash 3.2.57). Bash 3.2 has a known bug where expanding an empty array (${array[*]}) with set -u active triggers an "unbound variable" error, even when the array was properly initialized.
Line 6 sets set -euo pipefail, and line 113 does PROMPT="${PROMPT_PARTS[*]}". When no positional arguments have been collected into PROMPT_PARTS, the expansion fails before reaching the empty-prompt validation on line 116.
Fix
Either (or both):
-
Use
#!/usr/bin/env bashinstead of#!/bin/bashso users with a modern bash (e.g. via Homebrew) get it picked up automatically. -
Use a safe expansion on line 113:
PROMPT="${PROMPT_PARTS[*]:-}"This provides an empty default, avoiding the unbound variable error on bash 3.2.
Environment
- macOS (Darwin 25.3.0, Apple Silicon)
/bin/bash= GNU bash 3.2.57/opt/homebrew/bin/bash= GNU bash 5.3.9 (not used due to#!/bin/bash)