Skip to content

fix: bash 3.2 compatibility in create-new-feature.sh (${word^^} bad substitution on macOS)#3163

Open
comunicacaointeligente wants to merge 1 commit into
github:mainfrom
comunicacaointeligente:fix/bash32-uppercase-substitution
Open

fix: bash 3.2 compatibility in create-new-feature.sh (${word^^} bad substitution on macOS)#3163
comunicacaointeligente wants to merge 1 commit into
github:mainfrom
comunicacaointeligente:fix/bash32-uppercase-substitution

Conversation

@comunicacaointeligente

Copy link
Copy Markdown

Problem

scripts/bash/create-new-feature.sh uses ${word^^} (bash 4+ uppercase parameter expansion) on line 155. macOS ships with bash 3.2 by default, where this syntax fails:

create-new-feature.sh: line 155: \b${word^^}\b: bad substitution

The error is printed (4× for a multi-word description) and the elif branch is silently skipped, so the acronym-preservation logic stops working — short uppercase words like API get dropped from the generated branch name.

Reproduction (macOS, bash 3.2)

bash scripts/bash/create-new-feature.sh --json "Integrate API for posts"
# -> create-new-feature.sh: line 155: \b${word^^}\b: bad substitution

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

  • Single-line change, no behavior change on bash 4+.
  • Verified there are no other ${var^^} / ${var,,} usages under scripts/bash/.

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@mnriem

mnriem commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Please address Copilot feedback

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.

3 participants