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

[PATCH] Abort early if not being sourced under bash.

From
Ville Skyttä <ville.skytta@iki.fi>
Date
Feb 8, 2008, 21:10 UTC
Message-ID
<200802082310.34398.ville.skytta@iki.fi>
Subject: [PATCH] Abort early if not being sourced under bash.

This way, the file can be safely sourced from profile files shared with non-bash shells, eg. dropped into /etc/profile.d like directories.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
---
 contrib/completion/git-completion.bash |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 4ea727b..3cde9f4 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -45,6 +45,8 @@
 #       git@vger.kernel.org
 #
 
+[ -z "$BASH_VERSION" ] && return
+
 __gitdir ()
 {
 	if [ -z "$1" ]; then
-- 
1.5.3.8
Next: Johannes Schindelin
Message 1 of 3 in “Abort early if not being sourced under bash.”
  1. Abort early if not being sourced under bash.Ville Skyttä, Feb 8, 2008
  2. Johannes SchindelinFeb 8, 2008
  3. Junio C HamanoFeb 8, 2008

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.