git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
ASAndrew 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
Previous: Ævar Arnfjörð BjarmasonNext: solsTiCe d'Hiver
Message 3 of 7 in “[bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git”
  1. solsTiCe d'HiverJul 25, 2010
  2. Ævar Arnfjörð BjarmasonJul 25, 2010
  3. Andrew SayersJul 25, 2010
  4. solsTiCe d'HiverJul 25, 2010
  5. Andrew SayersJul 26, 2010
  6. solsTiCe d'HiverJul 27, 2010
  7. solsTiCe d'HiverJul 27, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.