aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Ollila <tomi.ollila@iki.fi>2013-08-20 19:16:43 +0300
committerDavid Bremner <bremner@debian.org>2013-09-08 22:42:12 -0300
commitfae15296eca133c53e17e379e2efc839e4c1907e (patch)
tree7279d798fe3dd0c020ef9b5a7a90bf247b20912b
parent819d7b4de2ae72b17742cd445d7dab801c4c412f (diff)
test: unset 'xpg_echo' bash shell option
When 'xpg_echo' bash shell option is unset (usually the default) echo builtin does not expand backslash-escape sequences by default (i.e. '\n' is echoed as '\n' instead of newline). Not all bash installations have this feature we depend on activated by default. Note that the feature is bash (and GNU /bin/echo) specific. It is used as it is convenient. If portability is needed (elsewhere) use printf(1) (also often available as a shell builtin).
-rw-r--r--test/test-lib.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index ffab1bb5..d3a8c58e 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -22,6 +22,9 @@ if [ ${BASH_VERSINFO[0]} -lt 4 ]; then
exit 1
fi
+# Make sure echo builtin does not expand backslash-escape sequences by default.
+shopt -u xpg_echo
+
# if --tee was passed, write the output not only to the terminal, but
# additionally to the file test-results/$BASENAME.out, too.
case "$GIT_TEST_TEE_STARTED, $* " in