fix: bash 3.2 compatibility in create-new-feature.sh (${word^^} bad substitution on macOS)#3163
Open
comunicacaointeligente wants to merge 1 commit into
Conversation
create-new-feature.sh used ${word^^} (bash 4+ parameter expansion) on
line 155. macOS ships bash 3.2 by default, where this fails with
'bad substitution', printing errors and silently dropping the
acronym-preservation logic (short uppercase words like API get removed
from generated branch names).
Replaced with $(echo "$word" | tr '[:lower:]' '[:upper:]'), which is
POSIX-compatible and works on bash 3.2 and 4+.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates scripts/bash/create-new-feature.sh to avoid Bash 4+–only ${var^^} uppercase expansion so the script runs correctly on macOS’s default Bash 3.2 and preserves acronyms in generated branch names.
Changes:
- Replaced Bash 4+ uppercase parameter expansion with a
tr-based uppercase conversion in the acronym-preservation check.
Show a summary per file
| File | Description |
|---|---|
| scripts/bash/create-new-feature.sh | Adjusts branch-name generation logic to be compatible with Bash 3.2 by removing ${var^^} usage. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
| if [ ${#word} -ge 3 ]; then | ||
| meaningful_words+=("$word") | ||
| elif echo "$description" | grep -q "\b${word^^}\b"; then | ||
| elif echo "$description" | grep -q "\b$(echo "$word" | tr '[:lower:]' '[:upper:]')\b"; then |
Collaborator
|
Please address Copilot feedback |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
scripts/bash/create-new-feature.shuses${word^^}(bash 4+ uppercase parameter expansion) on line 155. macOS ships with bash 3.2 by default, where this syntax fails:The error is printed (4× for a multi-word description) and the
elifbranch is silently skipped, so the acronym-preservation logic stops working — short uppercase words likeAPIget dropped from the generated branch name.Reproduction (macOS, bash 3.2)
Fix
Replace
${word^^}with$(echo "$word" | tr '[:lower:]' '[:upper:]')— POSIX-compatible, works on bash 3.2 and 4+.After the fix, no errors are printed and the acronym is correctly preserved in the branch name (e.g.
002-integrate-api-for-posts).Notes
${var^^}/${var,,}usages underscripts/bash/.