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

Re: [PATCH] bash-completion: Print a useful error when called in a non-bash shell

From
Johannes Sixt <j6t@kdbg.org>
Date
Aug 6, 2010, 21:31 UTC
Message-ID
<201008062331.38279.j6t@kdbg.org>
In-Reply-To
<4C50B005.1030004@pileofstuff.org>
On Donnerstag, 29. Juli 2010, Andrew Sayers wrote:
Show 5 quoted lines
> Detect whether the shell supports process substitution with <()
> Shells that fail the test will not be able to load git-completion.bash
>
> If a bad shell is found, print a warning which gives the user as much
> debugging information as possible.
This cannot work the way you implemented it:
> +$( 
> +	exec 2>/dev/null
> +	$(exec < <( ))
> + )

Any shell that does not support the <() syntax will have exited at this time with a syntax error and never get to print something.

This could work:
  (eval : '$(exec < <( ) )' 2>/dev/null)
> +if [[ 0 -ne $? ]]
Of course, you must not use unportable [[ ]] syntax here, either.
> +then
> +	cat <<EOF
> ...
-- Hannes
Previous: Stephen Boyd
Message 8 of 8 in “bash-completion: Print a useful error when called in a non-bash shell”
  1. bash-completion: Print a useful error when called in a non-bash shellAndrew Sayers, Jul 28, 2010
  2. Junio C HamanoJul 29, 2010
  3. solsTiCe d'HiverJul 29, 2010
  4. Andrew SayersJul 29, 2010
  5. Ævar Arnfjörð BjarmasonJul 29, 2010
  6. Junio C HamanoJul 29, 2010
  7. Stephen BoydJul 30, 2010
  8. Johannes SixtAug 6, 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.