Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 6 Sep 2012 07:50:06 +0200
From: Frank Dittrich <>
Subject: Re: bash completion on OSX

On 09/06/2012 12:50 AM, magnum wrote:
> Frank,
> While looking into getting bash completion working on OSX, I get this:
> $ . /usr/local/etc/bash_completion.d/john.bash_completion 
> bash: /usr/local/etc/bash_completion.d/john.bash_completion: line 159: syntax error near unexpected token `('
> bash: /usr/local/etc/bash_completion.d/john.bash_completion: line 159: `		-?(-)f?(o|or|orm|orma|ormat)+(=|:)dynamic*)'

Please post the output of
$ shopt -p extglob

Looks like bash's extended pattern matching features are not enabled on OSX.

The requirement is documented close to the begin of the script:

# This bash completion script requires bash version >= 4,
# and extended pattern matching features enabled. If
#       shopt -p extglob
# prints
#       shopt -s extglob
# then the extended pattern matching features enabled. If this command
# prints
#       shopt -u extglob
# then they are disabled.

May be I should add a similar comment close to the first syntax error
that occurs when extended pattern matching is disabled.
I do not suggest enabling it, because I don't know what negative side
effects it would have.

The correct solution for the problem is not to hard code all the
possible abbreviations of individual options.
Instead, I should create a look-up table which maps all unique
abbreviated option names to their long names, then use the long names
instead of pattern which might not be supported in all environments.

This had been on my to-do list for a while, but I didn't find the time.

Can you test if bash's syntax check complains about
as well (if you comment out or delete the
and subsequent lines?


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.