Whenever I open my terminal I get this error at the top:

bash: /etc/bash_completion.d/hping2: line 22: syntax error near unexpected token `$( compgen -W '02 04 08 10' )'
bash: /etc/bash_completion.d/hping2: line 22: `            $COMPREPLY=( $( compgen -W '02 04 08 10' ) )'

Remove the dollar sign at the begin of the line 22 and try again:

COMPREPLY=( $( compgen -W '02 04 08 10' ) )
  • It worked. Thank you. Do you have any idea what might have caused it? – Terra Oct 8 '11 at 15:18
  • It resides in /etc, which meant that unless it's been manually been modified, it may have been caused by an buggy update. Have you made an on your OS? In fact, what OS are you running? – Rilindo Oct 8 '11 at 19:45

This is caused by, ahem, a syntax error in one of the bash completion scripts (in this case it is the completion script for hping2). When the terminal starts a program called bash to handle your terminal session, bash run its initialization scripts, including the completion script /etc/bash_completion.d/hping2.

For some reason, that script on your computer is messed up (maybe somebody accidentally edited it), resulting in the syntax error. I think the right way to fix it would be to change that line to

COMPREPLY=( $( compgen -W '02 04 08 10' ) )

(remove the $ at the beginning of the line).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.