git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Andrew Sayers <andrew-git@pileofstuff.org>
Cc: Git Mailing List <git@vger.kernel.org>,
	"solsTiCe d'Hiver" <solstice.dhiver@gmail.com>
Subject: Re: [PATCH] bash-completion: Print a useful error when called in a non-bash shell
Date: Fri, 6 Aug 2010 23:31:38 +0200	[thread overview]
Message-ID: <201008062331.38279.j6t@kdbg.org> (raw)
In-Reply-To: <4C50B005.1030004@pileofstuff.org>

On Donnerstag, 29. Juli 2010, Andrew Sayers wrote:
> 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

      parent reply	other threads:[~2010-08-06 21:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-28 22:32 [PATCH] bash-completion: Print a useful error when called in a non-bash shell Andrew Sayers
2010-07-29 16:25 ` Junio C Hamano
2010-07-29 19:05   ` solsTiCe d'Hiver
2010-07-29 21:29   ` Andrew Sayers
2010-07-29 22:16     ` Ævar Arnfjörð Bjarmason
2010-07-29 23:38     ` Junio C Hamano
2010-07-30  6:02       ` Stephen Boyd
2010-08-06 21:31 ` Johannes Sixt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201008062331.38279.j6t@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=andrew-git@pileofstuff.org \
    --cc=git@vger.kernel.org \
    --cc=solstice.dhiver@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).