[PATCH v2 10/11] tests: split up bash detection library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Split up the detection for whether we're running under bash, and
whether it's the /bin/sh POSIX-y mode or the /bin/bash bash-y mode
into its own library.

This will soon be used very early in test-lib.sh itself to check for
the /bin/bash, so let's make this new file as small as possible.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 t/lib-bash-detection.sh | 8 ++++++++
 t/lib-bash.sh           | 4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 t/lib-bash-detection.sh

diff --git a/t/lib-bash-detection.sh b/t/lib-bash-detection.sh
new file mode 100644
index 0000000000..8fbdae1d52
--- /dev/null
+++ b/t/lib-bash-detection.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+TEST_SH_IS_BIN_BASH=
+if test -n "$BASH" && test -z "$POSIXLY_CORRECT"
+then
+	TEST_SH_IS_BIN_BASH=true
+	export TEST_SH_IS_BIN_BASH
+fi
diff --git a/t/lib-bash.sh b/t/lib-bash.sh
index b0b6060929..8fd06d2e58 100644
--- a/t/lib-bash.sh
+++ b/t/lib-bash.sh
@@ -2,7 +2,9 @@
 # to run under Bash; primarily intended for tests of the completion
 # script.
 
-if test -n "$BASH" && test -z "$POSIXLY_CORRECT"
+. ./lib-bash-detection.sh
+
+if test -n "$TEST_SH_IS_BIN_BASH"
 then
 	# we are in full-on bash mode
 	true
-- 
2.29.2.222.g5d2a92d10f8




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux