ohmybash / oh-my-bash

A delightful community-driven framework for managing your bash configuration, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
https://ohmybash.github.io
MIT License
5.97k stars 662 forks source link

defaults.completion.sh: Syntax Error on macOS with Bash #608

Closed cyberjames closed 1 month ago

cyberjames commented 1 month ago

After updating Oh My Bash, I encountered a syntax error in the defaults.completion.sh file, specifically at line 69. The error message is:

-bash: /Users/username/.oh-my-bash/completions/defaults.completion.sh: line 69: syntax error in conditional expression: unexpected token `('
-bash: /Users/username/.oh-my-bash/completions/defaults.completion.sh: line 69: syntax error near `@($'
-bash: /Users/username/.oh-my-bash/completions/defaults.completion.sh: line 69: `  if [[ ${COMP_WORDS[1]} == @(${cmds// /|}) ]]; then'

This error seems to be related to the use of @(...) syntax, which might not be fully supported in my Bash version.

Steps to Reproduce

  1. Update Oh My Bash to the latest version.
  2. Open a new terminal session.
  3. The error message appears.

Expected Behavior

Oh My Bash should load without errors, and tab completion should work correctly.

Actual Behavior

The syntax error prevents Oh My Bash from loading properly, and tab completion might be affected.

Environment

Workaround

I was able to temporarily fix the issue by reverting commit 74012c548c2fbd3f38a9c04dbf4e2cb3e38493b1.

Possible Solution

akinomyoga commented 1 month ago

I've already replied to #607. I'm closing this to avoid scattering the discussion.