From: Andrew Sayers Date: Wed, 28 Jul 2010 22:32:37 GMT Subject: [PATCH] bash-completion: Print a useful error when called in a non-bash shell Message-ID: <4C50B005.1030004@pileofstuff.org> 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 was added in response to a bug report on the git mailing list: http://permalink.gmane.org/gmane.comp.version-control.git/151723 Signed-off-by: Andrew Sayers --- My thanks to solsTiCe d'Hiver for reporting this bug. contrib/completion/git-completion.bash | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 6756990..3bbb4da 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -96,6 +96,31 @@ __gitdir () fi } +# Check in case we were called with something like "sh git-completion.bash": +$( + exec 2>/dev/null + $(exec < <( )) + ) +if [[ 0 -ne $? ]] +then + cat <