Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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' ) )'
share|improve this question
Could you please post the ~/.bashrc and ~/.profile? – quanta Oct 8 '11 at 13:53
bashrc - profile – Terra Oct 8 '11 at 13:58
and the snippet of /etc/bash_completion.d/hping2 around the line 22? – quanta Oct 8 '11 at 14:06
full script - – Terra Oct 8 '11 at 14:39
up vote 1 down vote accepted

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

COMPREPLY=( $( compgen -W '02 04 08 10' ) )
share|improve this answer
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).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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