Re: [bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git
- From
- Andrew Sayers <andrew-git@pileofstuff.org>
- Date
- Jul 25, 2010, 20:01 UTC
- Message-ID
- <4C4C982C.20904@pileofstuff.org>
- In-Reply-To
- <1280056320.7883.9.camel@soho.example.org>
"< <()" 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