Subject: Re: [bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git

From: Andrew Sayers <[email-masked]>
Date: Sun, 25 Jul 2010 21:01:48 +0100

"< <()" is indeed correct here: the first "<" is a normal shell
redirect, and the "<()" creates a sub-shell to read input from.  This
was the least messy way I could find to read variables into a shell.  "<
$()" won't do the job, and a normal pipe won't either:

$ FOO=parent ; echo child | { read ; FOO="$REPLY" ; } ; echo $FOO
parent
$ FOO=parent ; { read ; FOO="$REPLY" ; } < $( echo child ) ; echo $FOO
bash: child: No such file or directory
parent
$ FOO=parent ; { read ; FOO="$REPLY" ; } < <( echo child ) ; echo $FOO
child

Is "syntax error near unexpected token '<' on line 123" the complete
text of the error message you get?  bash 4.1.5 always prepends "bash: "
to such errors for me:

$ while false ; do echo foo ; done < ;
bash: syntax error near unexpected token `;'

If this is the complete error text, then I suspect you may have somehow
got bash completion in a non-bash shell.  Could you add this on line 98
and let me know what it says:

echo $BASH_VERSION $BASHOPTS

If it really is bash, $BASHOPTS might help me to replicate this problem
(or I might have to read the man page some more).

	- Andrew