petdance/ack — Issue #190: Syntax errors in ack.bash_completion.sh (OS X Lion, Homebrew)
Author: chrisvest
Created: 2011-10-13 21:48:45+00:00
State: open

I installed ack 1.96 with Homebrew on OS X Lion, and now my shell complains about the bash completion script:

-bash: /usr/local/etc/bash_completion.d/ack.bash_completion.sh: line 38: syntax error in conditional expression: unexpected token `('
-bash: /usr/local/etc/bash_completion.d/ack.bash_completion.sh: line 38: syntax error near `*+(['
-bash: /usr/local/etc/bash_completion.d/ack.bash_completion.sh: line 38: ` if [[ ${COMP_WORDS[@]} == *+([[:space:]])--@(help|man|th+([pt])+(t)|version)+([[:space:]])* ]] ; then'

When I comment out those lines in the script, I get this instead:

-bash: /usr/local/etc/bash_completion.d/ack.bash_completion.sh: line 135: syntax error in conditional expression: unexpected token `('
-bash: /usr/local/etc/bash_completion.d/ack.bash_completion.sh: line 135: syntax error near `-@(A'
-bash: /usr/local/etc/bash_completion.d/ack.bash_completion.sh: line 135: ` if [[ "${prev}" == -@(A|B|C|G|g|-match) ]] ; then'

And when I comment out those lines too, I get this:

-bash: /usr/local/etc/bash_completion.d/ack.bash_completion.sh: line 144: syntax error near unexpected token `('
-bash: /usr/local/etc/bash_completion.d/ack.bash_completion.sh: line 144: ` --?(no)ignore-dir) # directory completion'

Commenting out that part too, gets me this:

-bash: /usr/local/etc/bash_completion.d/ack.bash_completion.sh: line 153: syntax error near unexpected token `('
-bash: /usr/local/etc/bash_completion.d/ack.bash_completion.sh: line 153: ` --color-@(filename|match)) # color completion'

And then finally this:

-bash: have: command not found
-bash: have: command not found

But that's probably a different completion script (ack wasn't the only program I updated...)