Skip to content

Conversation

@ai-tesi
Copy link
Contributor

@ai-tesi ai-tesi commented Jan 27, 2026

Summary

  • Replace ${var^^} and ${var,,} with helper functions using tr

Problem

After merging #26, the install still fails on bash 3.2:

lib/functions.sh: line 59: ${level^^}: bad substitution

The ${var^^} (uppercase) and ${var,,} (lowercase) operators require bash 4+.

Solution

Add helper functions in lib/functions.sh:

_mt_uppercase() {
  echo "$1" | tr '[:lower:]' '[:upper:]'
}

_mt_lowercase() {
  echo "$1" | tr '[:upper:]' '[:lower:]'
}

Then replace all usages:

  • ${var^^}$(_mt_uppercase "$var")
  • ${var,,}$(_mt_lowercase "$var")

Changes

File Replacements
lib/functions.sh 5 + helper functions
lib/prompt.sh 8

Testing

Tested on fresh macOS Tahoe VM (arm64) with bash 3.2.57.

Note

This is the second of potentially several PRs needed for full bash 3.2 compatibility. Remaining issues may include:

  • mapfile in lib/service.sh (7 usages)
  • declare -A associative arrays (if any critical paths use them)

🤖 Generated with Claude Code

Replace ${var^^} and ${var,,} with helper functions that use tr.
These bash 4+ case conversion operators fail on macOS default bash 3.2.

Changes:
- Add _mt_uppercase() and _mt_lowercase() helper functions
- Replace all ${var^^} with $(_mt_uppercase "$var")
- Replace all ${var,,} with $(_mt_lowercase "$var")

Files changed:
- lib/functions.sh: 5 replacements + helper functions
- lib/prompt.sh: 8 replacements

Tested on macOS Tahoe (arm64) with bash 3.2.57.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@mbailey mbailey merged commit 2a67a75 into mbailey:master Jan 27, 2026
1 check passed
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.

2 participants