[PATCH] test: change "#!/bin/bash" to "#!/usr/bin/env bash" enhances portability

Joel Borggrén-Franck joel.borggren.franck at gmail.com
Wed Dec 1 12:27:52 PST 2010


From: Joel Borggrén-Franck <jbf at codehouse.se>

Change #!/bin/bash at start of tests to "#!/usr/bin/env bash". That way
systems running on bash < 4 can prepend bash >= 4 to path before
running the tests.
---
 test/README               |    6 +++---
 test/aggregate-results.sh |    2 +-
 test/author-order         |    2 +-
 test/basic                |    2 +-
 test/dump-restore         |    2 +-
 test/emacs                |    2 +-
 test/encoding             |    2 +-
 test/from-guessing        |    2 +-
 test/json                 |    2 +-
 test/long-id              |    2 +-
 test/maildir-sync         |    2 +-
 test/new                  |    2 +-
 test/notmuch-test         |    2 +-
 test/raw                  |    2 +-
 test/reply                |    2 +-
 test/search               |    2 +-
 test/search-output        |    2 +-
 test/test-lib.sh          |    2 +-
 test/test-verbose         |    2 +-
 test/thread-naming        |    2 +-
 test/thread-order         |    2 +-
 test/uuencode             |    2 +-
 test/valgrind/valgrind.sh |    2 +-
 23 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/test/README b/test/README
index ebaa3cf..07da480 100644
--- a/test/README
+++ b/test/README
@@ -68,11 +68,11 @@ remaining tests to be unaffected.
 
 Writing Tests
 -------------
-The test script is written as a shell script.  It should start
-with the standard "#!/bin/bash" with copyright notices, and an
+The test script is written as a shell script.  It should start with
+the standard "#!/usr/bin/env bash" with copyright notices, and an
 assignment to variable 'test_description', like this:
 
-	#!/bin/bash
+	#!/usr/bin/env bash
 	#
 	# Copyright (c) 2005 Junio C Hamano
 	#
diff --git a/test/aggregate-results.sh b/test/aggregate-results.sh
index 0f1ea33..732d6ca 100755
--- a/test/aggregate-results.sh
+++ b/test/aggregate-results.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
 
 fixed=0
 success=0
diff --git a/test/author-order b/test/author-order
index 9f0b931..2d79873 100755
--- a/test/author-order
+++ b/test/author-order
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description="author reordering;"
 . ./test-lib.sh
 
diff --git a/test/basic b/test/basic
index 309779c..e20e994 100755
--- a/test/basic
+++ b/test/basic
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # Copyright (c) 2005 Junio C Hamano
 #
diff --git a/test/dump-restore b/test/dump-restore
index 0d78f01..a4de370 100755
--- a/test/dump-restore
+++ b/test/dump-restore
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description="\"notmuch dump\" and \"notmuch restore\""
 . ./test-lib.sh
 
diff --git a/test/emacs b/test/emacs
index 75dec89..baa6f3d 100755
--- a/test/emacs
+++ b/test/emacs
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description="emacs interface"
 . test-lib.sh
 
diff --git a/test/encoding b/test/encoding
index 68cb8ee..673b039 100755
--- a/test/encoding
+++ b/test/encoding
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description="encoding issues"
 . ./test-lib.sh
 
diff --git a/test/from-guessing b/test/from-guessing
index 6744e68..d8727bb 100755
--- a/test/from-guessing
+++ b/test/from-guessing
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description="From line heuristics (with multiple configured addresses)"
 . ./test-lib.sh
 
diff --git a/test/json b/test/json
index 7fe2a27..1978f8b 100755
--- a/test/json
+++ b/test/json
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description="--format=json output"
 . ./test-lib.sh
 
diff --git a/test/long-id b/test/long-id
index 84f9294..85e620f 100755
--- a/test/long-id
+++ b/test/long-id
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description="messages with ridiculously-long message IDs"
 . ./test-lib.sh
 
diff --git a/test/maildir-sync b/test/maildir-sync
index 50a5b8e..2b43127 100755
--- a/test/maildir-sync
+++ b/test/maildir-sync
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 test_description="maildir synchronization"
 
diff --git a/test/new b/test/new
index 7b396ae..1b7296e 100755
--- a/test/new
+++ b/test/new
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description='"notmuch new" in several variations'
 . ./test-lib.sh
 
diff --git a/test/notmuch-test b/test/notmuch-test
index 43565e8..d753c81 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Run tests
 #
diff --git a/test/raw b/test/raw
index 4ed237c..b7e265a 100755
--- a/test/raw
+++ b/test/raw
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr//bin/env bash
 
 test_description='notmuch show --format=raw'
 . ./test-lib.sh
diff --git a/test/reply b/test/reply
index 99c3376..c0b8e26 100755
--- a/test/reply
+++ b/test/reply
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description="\"notmuch reply\" in several variations"
 . ./test-lib.sh
 
diff --git a/test/search b/test/search
index b180c7f..2085fe6 100755
--- a/test/search
+++ b/test/search
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description='"notmuch search" in several variations'
 . ./test-lib.sh
 
diff --git a/test/search-output b/test/search-output
index b414993..ef870bf 100755
--- a/test/search-output
+++ b/test/search-output
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description='various settings for "notmuch search --output="'
 . ./test-lib.sh
 
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 04a4c14..89c9a4c 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # Copyright (c) 2005 Junio C Hamano
 #
diff --git a/test/test-verbose b/test/test-verbose
index f29a9c7..4100c05 100755
--- a/test/test-verbose
+++ b/test/test-verbose
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 test_description='the verbosity options of the test framework itself.'
 
diff --git a/test/thread-naming b/test/thread-naming
index bcc3d61..41b97d9 100755
--- a/test/thread-naming
+++ b/test/thread-naming
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description="naming of threads with changing subject"
 . ./test-lib.sh
 
diff --git a/test/thread-order b/test/thread-order
index 1819fce..6c3a4b3 100755
--- a/test/thread-order
+++ b/test/thread-order
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description="threading when messages received out of order"
 . ./test-lib.sh
 
diff --git a/test/uuencode b/test/uuencode
index d509320..d0d16bd 100755
--- a/test/uuencode
+++ b/test/uuencode
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 test_description="handling of uuencoded data"
 . ./test-lib.sh
 
diff --git a/test/valgrind/valgrind.sh b/test/valgrind/valgrind.sh
index 3bc90f5..78700c0 100755
--- a/test/valgrind/valgrind.sh
+++ b/test/valgrind/valgrind.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
 
 base=$(basename "$0")
 
-- 
1.7.3.2



More information about the notmuch mailing list