Skip to content

fix: Replace bash4-only lowercase expansion with bash3.2 compatible tr#165

Open
Rusty-Alucard wants to merge 1 commit into
yohey-w:mainfrom
Rusty-Alucard:fix/bash32-compat
Open

fix: Replace bash4-only lowercase expansion with bash3.2 compatible tr#165
Rusty-Alucard wants to merge 1 commit into
yohey-w:mainfrom
Rusty-Alucard:fix/bash32-compat

Conversation

@Rusty-Alucard

Copy link
Copy Markdown
Contributor

Problem

lib/cli_adapter.sh uses the ${var,,} lowercase expansion syntax which is a bash 4.0+ feature. This causes a bad substitution error on macOS, where the system /bin/bash is version 3.2.

lib/cli_adapter.sh: line 29: cli_type=${cli_type,,}: bad substitution

Fix

Replace ${cli_type,,} with a POSIX-compatible tr pipeline:

# Before (bash 4+ only)
cli_type="${cli_type,,}"

# After (bash 3.2 compatible)
cli_type="$(echo "$cli_type" | tr '[:upper:]' '[:lower:]')"

Compatibility

  • ✅ bash 3.2 (macOS default /bin/bash)
  • ✅ bash 4.x
  • ✅ bash 5.x
  • ✅ POSIX-compliant (uses tr which is universally available)

Testing

The tr '[:upper:]' '[:lower:]' approach correctly lowercases strings on both bash 3.2 and bash 4+, and handles all the alias cases (gemini, agyantigravity) that the _cli_adapter_normalize_cli_type function is designed for.

${var,,} is a bash 4.0+ feature not available in bash 3.2 (macOS default).
Replace with portable POSIX-compatible tr '[:upper:]' '[:lower:]'.

Fixes startup failure on macOS where /bin/bash is 3.2:
  lib/cli_adapter.sh: bad substitution
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