automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, master, updated. v1.12.1-11


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, master, updated. v1.12.1-110-g3b83966
Date: Fri, 22 Jun 2012 17:03:59 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=3b83966e81cd038e79be4225225787d3766c54ec

The branch, master has been updated
       via  3b83966e81cd038e79be4225225787d3766c54ec (commit)
       via  13dd512dae7f338426dfb152bc77c4c5fdd25278 (commit)
       via  dc18830f56e88efa2cd92e663d30b9d4f0f27f1b (commit)
       via  9c90cf76767e4629349e3cce61dc587185f4eda1 (commit)
       via  74c0fd3e53c75d08ac4c428b0a2f5d21f189a34b (commit)
       via  062aeb245e68208dccb3ccc9b28e100a81dbc79b (commit)
       via  3a1a8c6d3cb46bfe65b715ddd8a3e0d7e27e1bf7 (commit)
       via  6e713425a0dcede167924e7691e95ab5e54e399c (commit)
      from  488de31efa525d864ad56cd023f3b33c83101088 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3b83966e81cd038e79be4225225787d3766c54ec
Merge: 062aeb2 13dd512
Author: Stefano Lattarini <address@hidden>
Date:   Fri Jun 22 18:55:01 2012 +0200

    Merge branch 'maint'
    
    * maint:
      tests: prefer using 'is_newest' over 'ls -t' hacks
      tests: implement is_newest as an auxiliary script, not shell function
      tests: fix some spurious failures in VPATH setup
      tests: work in VPATH setup again

commit 062aeb245e68208dccb3ccc9b28e100a81dbc79b
Merge: 488de31 3a1a8c6
Author: Stefano Lattarini <address@hidden>
Date:   Fri Jun 22 14:52:21 2012 +0200

    Merge branch 'maint'
    
    * maint:
      tests: automatic re-execution works for non-POSIX shells too
      tests: use more POSIX shell features our test scripts
    
    + Extra non-trivial edits:
    
    * t/ax/test-init.sh: Apply the diffs between past versions of
    'defs' in maint and in master; i.e., remove handling of $required
    entries 'texi2dvi-o' and 'makeinfo-html', and adjust to the fact
    that the parallel testsuite harness is now the default.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 Makefile.am                                        |    9 +-
 defs                                               | 1086 +-------------------
 syntax-checks.mk                                   |   13 +-
 t/README                                           |   16 +
 t/ac-output-old.tap                                |    2 +-
 t/acloca13.sh                                      |    5 +-
 t/acloca14.sh                                      |   24 +-
 t/acloca15.sh                                      |    2 +-
 t/acloca18.sh                                      |    2 +-
 t/aclocal-install-absdir.sh                        |    2 +-
 t/aclocal-install-mkdir.sh                         |    6 +-
 t/aclocal-path-install-serial.sh                   |    2 +-
 t/aclocal-path-install.sh                          |    2 +-
 t/aclocal-path-nonexistent.sh                      |    2 +-
 t/aclocal-path.sh                                  |    2 +-
 t/aclocal-print-acdir.sh                           |    6 +-
 t/aclocal7.sh                                      |   72 +-
 t/aclocal8.sh                                      |    2 +-
 t/add-missing.tap                                  |    6 +-
 t/amhello-binpkg.sh                                |    6 +-
 t/amhello-cross-compile.sh                         |    2 +-
 t/ar-lib.sh                                        |   34 +-
 t/ar-lib5b.sh                                      |    2 +-
 t/autodist-no-duplicate.sh                         |    4 +-
 t/autodist-subdir.sh                               |    2 +-
 t/autodist.sh                                      |    2 +-
 t/autohdr4.sh                                      |    8 +-
 t/ax/depcomp.sh                                    |    4 +-
 t/{aclocal-no-install-no-mkdir.sh => ax/is_newest} |   35 +-
 t/ax/tap-functions.sh                              |   38 +-
 t/ax/tap-summary-aux.sh                            |    6 +-
 defs => t/ax/test-init.sh                          |  138 +--
 t/c-demo.sh                                        |    2 +-
 t/candist.sh                                       |    2 +-
 t/ccnoco.sh                                        |    2 +-
 t/ccnoco3.sh                                       |    8 +-
 t/check12.sh                                       |    9 +-
 t/check3.sh                                        |    2 +-
 t/check4.sh                                        |    2 +-
 t/color.sh                                         |    2 +-
 t/color2.sh                                        |    2 +-
 t/comment4.sh                                      |   12 +-
 t/comment7.sh                                      |    8 +-
 t/compile3.sh                                      |   16 +-
 t/compile4.sh                                      |   20 +-
 t/compile5.sh                                      |   13 +-
 t/compile6.sh                                      |   40 +-
 t/cond14.sh                                        |    2 +-
 t/cond15.sh                                        |    4 +-
 t/cond33.sh                                        |    2 +-
 t/cond35.sh                                        |    2 +-
 t/cond36.sh                                        |    2 +-
 t/cond42.sh                                        |    2 +-
 t/cond5.sh                                         |    6 +-
 t/cond6.sh                                         |    2 +-
 t/cond8.sh                                         |    2 +-
 t/condhook.sh                                      |    2 +-
 t/condhook2.sh                                     |    2 +-
 t/condman3.sh                                      |    4 +-
 t/copy.sh                                          |    2 +-
 t/cscope.tap                                       |    2 +-
 t/dejagnu-siteexp-useredit.sh                      |    2 +-
 t/dejagnu2.sh                                      |    2 +-
 t/dejagnu4.sh                                      |    4 +-
 t/depend.sh                                        |    4 +-
 t/depend4.sh                                       |    2 +-
 t/dirlist-abspath.sh                               |    2 +-
 t/dist-auxdir-many-subdirs.sh                      |    4 +-
 t/dist-auxfile.sh                                  |    2 +-
 t/dist-formats.tap                                 |   81 +-
 t/dist-included-parent-dir.sh                      |    4 +-
 t/dist-missing-am.sh                               |    2 +-
 t/dist-missing-included-m4.sh                      |    2 +-
 t/dist-missing-m4.sh                               |    2 +-
 t/dist-repeated.sh                                 |    4 +-
 t/distcheck-missing-m4.sh                          |    2 +-
 t/distcheck-outdated-m4.sh                         |    2 +-
 t/distcheck-override-infodir.sh                    |    2 +-
 t/distcheck-pr9579.sh                              |    2 +-
 t/distcom4.sh                                      |    2 +-
 t/distcom5.sh                                      |    4 +-
 t/distdir.sh                                       |    2 +-
 t/disthook.sh                                      |    3 +-
 t/distlinks.sh                                     |    2 +-
 t/distlinksbrk.sh                                  |    2 +-
 t/dollar.sh                                        |    4 +-
 t/empty.sh                                         |    4 +-
 t/exeext.sh                                        |    4 +-
 t/exeext3.sh                                       |    6 +-
 t/exeext4.sh                                       |    2 +-
 t/ext.sh                                           |   13 +-
 t/extradep.sh                                      |    4 +-
 t/extradep2.sh                                     |    4 +-
 t/fn99.sh                                          |    2 +-
 t/fn99subdir.sh                                    |    2 +-
 t/fort4.sh                                         |    4 +-
 t/fort5.sh                                         |    4 +-
 t/gcj3.sh                                          |    3 +-
 t/gcj4.sh                                          |    4 +-
 t/gettext-macros.sh                                |    8 +-
 t/gnits2.sh                                        |    2 +-
 t/gnits3.sh                                        |    2 +-
 t/hdr-vars-defined-once.sh                         |    3 +-
 t/help-silent.sh                                   |    6 +-
 t/help4.sh                                         |    2 +-
 t/info.sh                                          |    2 +-
 t/install-info-dir.sh                              |    2 +-
 t/installdir.sh                                    |    4 +-
 t/instdir-cond.sh                                  |    2 +-
 t/instdir-cond2.sh                                 |    2 +-
 t/instdir-java.sh                                  |    5 +-
 t/instdir-lisp.sh                                  |    5 +-
 t/instdir-ltlib.sh                                 |    5 +-
 t/instdir-no-empty.sh                              |    2 +-
 t/instdir-prog.sh                                  |    5 +-
 t/instdir-python.sh                                |    5 +-
 t/instdir-texi.sh                                  |    5 +-
 t/instdir.sh                                       |    5 +-
 t/instdir2.sh                                      |    5 +-
 t/instfail-info.sh                                 |    2 +-
 t/instfail-java.sh                                 |    2 +-
 t/instfail-libtool.sh                              |    2 +-
 t/instfail.sh                                      |    7 +-
 t/insthook.sh                                      |    2 +-
 t/instman.sh                                       |    6 +-
 t/instmany-mans.sh                                 |    8 +-
 t/instmany-python.sh                               |    8 +-
 t/instmany.sh                                      |    8 +-
 t/instspc.tap                                      |   10 +-
 t/java-check.sh                                    |    2 +-
 t/java-compile-install.sh                          |    2 +-
 t/java-compile-run-flat.sh                         |    2 +-
 t/java-compile-run-nested.sh                       |    2 +-
 t/java-no-duplicate.sh                             |    4 +-
 t/java-nobase.sh                                   |    2 +-
 t/java-noinst.sh                                   |    2 +-
 t/java-uninstall.sh                                |    2 +-
 t/java.sh                                          |   19 +-
 t/java3.sh                                         |    3 +-
 t/lex-depend-cxx.sh                                |    6 +-
 t/lex-depend.sh                                    |   12 +-
 t/lex-lib-external.sh                              |    2 +-
 t/lex-noyywrap.sh                                  |    2 +-
 t/lex-pr204.sh                                     |    5 +-
 t/lex3.sh                                          |    2 +-
 t/library3.sh                                      |    4 +-
 t/libtool-macros.sh                                |    2 +-
 t/libtool6.sh                                      |    4 +-
 t/libtool7.sh                                      |    4 +-
 t/lisp3.sh                                         |    2 +-
 t/lisp4.sh                                         |    6 +-
 t/lisp5.sh                                         |    6 +-
 t/lisp6.sh                                         |    9 +-
 t/lisp7.sh                                         |    2 +-
 t/lisp8.sh                                         |    4 +-
 t/list-of-tests.mk                                 |    1 -
 t/longlin2.sh                                      |   10 +-
 t/longline.sh                                      |    4 +-
 t/ltcond.sh                                        |    9 +-
 t/ltconv.sh                                        |   16 +-
 t/ltinit.sh                                        |    3 +-
 t/ltorder.sh                                       |    4 +-
 t/maintmode-configure-msg.sh                       |    3 +-
 t/make-dryrun.tap                                  |    6 +-
 t/makej2.sh                                        |    4 +-
 t/maken.sh                                         |    6 +-
 t/man2.sh                                          |    6 +-
 t/man4.sh                                          |    2 +-
 t/man5.sh                                          |   36 +-
 t/mdate5.sh                                        |    4 +-
 t/missing5.sh                                      |    2 +-
 t/mkinst2.sh                                       |    6 +-
 t/mkinst3.sh                                       |   15 +-
 t/mmodely.sh                                       |    8 +-
 t/multlib.sh                                       |    4 +-
 t/nobase-libtool.sh                                |   11 +-
 t/nobase-python.sh                                 |    7 +-
 t/nobase.sh                                        |    8 +-
 t/nodist2.sh                                       |    2 +-
 t/notrans.sh                                       |   22 +-
 t/number.sh                                        |    5 +-
 t/objc-megademo.sh                                 |    2 +-
 t/objext-pr10128.sh                                |    4 +-
 t/oldvars.sh                                       |    4 +-
 t/output8.sh                                       |    6 +-
 t/override-conditional-1.sh                        |    2 +-
 t/override-html.sh                                 |    2 +-
 t/parallel-am.sh                                   |    2 +-
 t/parallel-tests-exit-statuses.sh                  |    8 +-
 t/parallel-tests-interrupt.tap                     |    2 +-
 t/parallel-tests-log-compiler-1.sh                 |    2 +-
 t/parallel-tests-many.sh                           |   13 +-
 t/parallel-tests-trailing-bslash.sh                |    2 +-
 t/parallel-tests.sh                                |    4 +-
 t/parallel-tests2.sh                               |    6 +-
 t/parallel-tests3.sh                               |    4 +-
 t/phony.sh                                         |    4 +-
 t/pluseq5.sh                                       |    2 +-
 t/pluseq6.sh                                       |    6 +-
 t/pluseq7.sh                                       |    3 +-
 t/pluseq9.sh                                       |    2 +-
 t/posixsubst-data.sh                               |    2 +-
 t/posixsubst-libraries.sh                          |    2 +-
 t/posixsubst-ltlibraries.sh                        |    2 +-
 t/posixsubst-programs.sh                           |    2 +-
 t/posixsubst-scripts.sh                            |    2 +-
 t/pr287.sh                                         |    3 +-
 t/pr300-lib.sh                                     |    2 +-
 t/pr300-ltlib.sh                                   |    2 +-
 t/pr300-prog.sh                                    |    2 +-
 t/pr87.sh                                          |    2 +-
 t/primary-prefix-couples-force-valid.sh            |    2 +-
 t/print-libdir.sh                                  |    2 +-
 t/py-compile-basedir.sh                            |    2 +-
 t/py-compile-basic2.sh                             |    2 +-
 t/py-compile-usage.sh                              |   12 +-
 t/python-pr10995.sh                                |   12 +-
 t/python-vars.sh                                   |    4 +-
 t/python-virtualenv.sh                             |    4 +-
 t/python.sh                                        |    4 +-
 t/python10.sh                                      |   14 +-
 t/python12.sh                                      |    6 +-
 t/python3.sh                                       |   10 +-
 t/python5b.sh                                      |    2 +-
 t/python6.sh                                       |    2 +-
 t/python7.sh                                       |    2 +-
 t/python9.sh                                       |    2 +-
 t/remake-subdir-long-time.sh                       |    2 +-
 t/remake11.sh                                      |    5 +-
 t/remake6.sh                                       |   23 +-
 t/remake9a.sh                                      |    4 +-
 t/remake9b.sh                                      |    4 +-
 t/remake9c.sh                                      |    4 +-
 t/remake9d.sh                                      |    4 +-
 t/self-check-cleanup.tap                           |   22 +-
 t/self-check-dir.tap                               |   10 +-
 t/self-check-explicit-skips.sh                     |   34 +-
 t/self-check-me.tap                                |    2 +-
 t/self-check-reexec.tap                            |    6 +-
 t/self-check-sanity.sh                             |   77 --
 t/self-check-seq.tap                               |    2 +-
 t/silent-many-gcc.sh                               |    4 +-
 t/silent-many-generic.sh                           |    6 +-
 t/specflg6.sh                                      |    4 +-
 t/specflg7.sh                                      |    2 +-
 t/specflg8.sh                                      |    2 +-
 t/spy.sh                                           |    6 +-
 t/stdlib.sh                                        |    5 +-
 t/strip.sh                                         |    2 +-
 t/strip2.sh                                        |   15 +-
 t/strip3.sh                                        |   15 +-
 t/subobj-clean-lt-pr10697.sh                       |   10 +-
 t/subobj-clean-pr10697.sh                          |   12 +-
 t/subobj11a.sh                                     |    2 +-
 t/subobj11b.sh                                     |    2 +-
 t/subobj9.sh                                       |    2 +-
 t/subobjname.sh                                    |   16 +-
 t/subst-no-trailing-empty-line.sh                  |    2 +-
 t/subst3.sh                                        |   14 +-
 t/substtarg.sh                                     |    5 +-
 t/suffix.sh                                        |    8 +-
 t/suffix2.sh                                       |    8 +-
 t/symlink.sh                                       |    2 +-
 t/tap-bailout-suppress-later-errors.sh             |    6 +-
 t/tap-basic.sh                                     |    2 +-
 t/tap-diagnostic-custom.sh                         |    2 +-
 t/tap-diagnostic.sh                                |    2 +-
 t/tap-fancy.sh                                     |    4 +-
 t/tap-fancy2.sh                                    |   14 +-
 t/tap-global-log.sh                                |    2 +-
 t/tap-global-result.sh                             |    6 +-
 t/tap-log.sh                                       |    8 +-
 t/tap-more.sh                                      |   12 +-
 t/tap-no-spurious-numbers.sh                       |   14 +-
 t/tap-no-spurious.sh                               |   12 +-
 t/tap-number-wordboundary.sh                       |    2 +-
 t/tap-out-of-order.sh                              |    8 +-
 t/tap-plan-malformed.sh                            |    2 +-
 t/tap-plan-middle.sh                               |    2 +-
 t/tap-planskip-case-insensitive.sh                 |   11 +-
 t/tap-planskip-late.sh                             |    2 +-
 t/tap-planskip-later-errors.sh                     |    2 +-
 t/tap-planskip.sh                                  |    2 +-
 t/tap-realtime.sh                                  |    2 +-
 t/tap-signal.tap                                   |    6 +-
 t/tap-unplanned.sh                                 |    2 +-
 t/tar-override.sh                                  |    6 +-
 t/tar3.sh                                          |    2 +-
 t/target-cflags.sh                                 |    4 +-
 t/test-driver-create-log-dir.sh                    |    8 +-
 t/test-driver-custom-multitest.sh                  |    2 +-
 t/test-driver-custom-xfail-tests.sh                |   10 +-
 t/test-driver-custom.sh                            |    2 +-
 t/test-driver-is-distributed.sh                    |    2 +-
 t/test-driver-strip-vpath.sh                       |    2 +-
 t/test-extensions-cond.sh                          |    2 +-
 t/test-extensions.sh                               |    4 +-
 t/test-log.sh                                      |   10 +-
 t/test-metadata-global-result.sh                   |    2 +-
 t/test-metadata-recheck.sh                         |    2 +-
 t/test-trs-basic.sh                                |    4 +-
 t/testsuite-summary-count.sh                       |   24 +-
 t/transform.sh                                     |    7 +-
 t/transform2.sh                                    |   14 +-
 t/transform3.sh                                    |    4 +-
 t/txinfo19.sh                                      |    2 +-
 t/txinfo21.sh                                      |    3 +-
 t/txinfo26.sh                                      |   10 +-
 t/txinfo27.sh                                      |    4 +-
 t/txinfo29.sh                                      |    4 +-
 t/txinfo30.sh                                      |    2 +-
 t/txinfo32.sh                                      |    4 +-
 t/txinfo9.sh                                       |    2 +-
 t/uninstall-fail.sh                                |    3 +-
 t/uninstall-pr9578.sh                              |    2 +-
 t/vala-mix.sh                                      |    2 +-
 t/vala-vapi.sh                                     |    2 +-
 t/vala.sh                                          |    4 +-
 t/vala4.sh                                         |    5 +-
 t/vala5.sh                                         |    6 +-
 t/vartypo2.sh                                      |    3 +-
 t/vartypos.sh                                      |    2 +-
 t/version6.sh                                      |    2 +-
 t/vtexi3.sh                                        |    2 +-
 t/vtexi4.sh                                        |   14 +-
 t/warnings-win-over-strictness.sh                  |    2 +-
 t/warnopts.sh                                      |    4 +-
 t/werror4.sh                                       |    6 +-
 t/yacc-basic.sh                                    |    2 +-
 t/yacc-cxx.sh                                      |    2 +-
 t/yacc-depend2.sh                                  |   15 +-
 t/yacc-dist-nobuild.sh                             |    2 +-
 t/yacc-pr204.sh                                    |    5 +-
 t/yacc8.sh                                         |    6 +-
 t/yflags-force-conditional.sh                      |    2 +-
 335 files changed, 1051 insertions(+), 2201 deletions(-)
 copy t/{aclocal-no-install-no-mkdir.sh => ax/is_newest} (58%)
 copy defs => t/ax/test-init.sh (90%)
 delete mode 100755 t/self-check-sanity.sh

diff --git a/Makefile.am b/Makefile.am
index e581cf2..872714e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -322,7 +322,7 @@ TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) 
$(srcdir)/lib/tap-driver.sh
 
 AM_TAP_LOG_DRIVER_FLAGS = --merge
 
-EXTRA_DIST += t/README t/ax/is
+EXTRA_DIST += t/README t/ax/is t/ax/is_newest
 
 TESTS = ## Will be updated later.
 
@@ -381,8 +381,11 @@ $(srcdir)/t/testsuite-part.am: 
$(srcdir)/gen-testsuite-part Makefile.am
 
 # Static dependencies valid for each test case.
 check_SCRIPTS = t/wrap/aclocal-$(APIVERSION) t/wrap/automake-$(APIVERSION)
-dist_check_DATA = t/ax/plain-functions.sh t/ax/tap-functions.sh
-check_DATA = defs defs-static
+dist_check_DATA = \
+  t/ax/test-init.sh  \
+  t/ax/plain-functions.sh  \
+  t/ax/tap-functions.sh
+nodist_check_DATA = defs-static
 
 # Few more static dependencies.
 t/distcheck-missing-m4.log: t/ax/distcheck-hook-m4.am
diff --git a/defs b/defs
index 0b01f59..d16758c 100644
--- a/defs
+++ b/defs
@@ -15,84 +15,25 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-########################################################
-###  IMPORTANT NOTE: keep this file 'set -e' clean.  ###
-########################################################
-
-# NOTE: This file should execute correctly with any system's /bin/sh
-# shell, and not only with configure-time detected $AM_TEST_RUNNER_SHELL,
-# *until differently and explicitly specified*.
-
-## -------------------------------------------------------- ##
-##  Source static setup and definitions for the testsuite.  ##
-## -------------------------------------------------------- ##
-
-# Ensure we are running from the right directory.
-test -f ./defs-static || {
-   echo "$0: ./defs-static: not found in current directory" >&2
-   exit 99
-}
-
-# Source the shell sanitization and variables' definitions.
-. ./defs-static || exit 99
-
-# Enable the errexit shell flag early.
-set -e
-
-# The name of the current test (without the '.sh' or '.tap' suffix).
-# Test scripts can override it if they need to (but this should
-# be done carefully, and *before* including ./defs).
-if test -z "$me"; then
-  # Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
-  me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.sh$//;s/\.tap$//'` \
-    && test -n "$me" \
-    || { echo "$argv0: failed to define \$me" >&2; exit 99; }
-fi
-
-## ---------------------- ##
-##  Early sanity checks.  ##
-## ---------------------- ##
-
-# A single whitespace character.
-sp=' '
-# A tabulation character.
-tab='  '
-# A newline character.
-nl='
-'
-
-# As autoconf-generated configure scripts do, ensure that IFS
-# is defined initially, so that saving and restoring $IFS works.
-IFS=$sp$tab$nl
-
-# Ensure $am_top_srcdir is set correctly.
-test -f "$am_top_srcdir/defs-static.in" || {
-   echo "$me: $am_top_srcdir/defs-static.in not found," \
-        "check \$am_top_srcdir" >&2
-   exit 99
-}
-
-# Ensure $am_top_builddir is set correctly.
-test -f "$am_top_builddir/defs-static" || {
-   echo "$me: $am_top_builddir/defs-static not found," \
-        "check \$am_top_builddir" >&2
-   exit 99
-}
-
-
-## ------------------------------------ ##
-##  Ensure we run with a proper shell.  ##
-## ------------------------------------ ##
-
-# Make sure we run with the shell detected at configure time (unless
-# the user forbids it).
+# *** IMPORTANT NOTE ***
+# This file should execute correctly with any system's /bin/sh (which
+# might be just a Bourne shell, non POSIX-conforming, like on Solaris
+# up to version 11 at least).
+
+# Source the shell static setup and variable definitions.
+. ./defs-static
+test $? -eq 0 || exit 99
+
+# Make sure we run with the shell detected at configure time or forced
+# by the user (unless the user forbids it).  That is assumed to be a
+# proper POSIX shell.
 case ${AM_TESTS_REEXEC-yes} in
   n|no|false|0)
     ;;
   *)
     # Ensure we can find ourselves.
     if test ! -f "$0"; then
-      echo "$me: unable to find myself: $0" >&2
+      echo "$0: unable to find myself" >&2
       exit 99
     fi
     AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
@@ -105,999 +46,14 @@ case ${AM_TESTS_REEXEC-yes} in
       *x*) opts=-x;;
       *) opts=;;
     esac
-    echo $me: exec $AM_TEST_RUNNER_SHELL $opts "$0" "$*"
-    exec $AM_TEST_RUNNER_SHELL $opts "$0" ${1+"$@"} || {
-      echo "$me: failed to re-execute with $AM_TEST_RUNNER_SHELL" >&2
-      exit 99
-    }
+    echo exec $AM_TEST_RUNNER_SHELL $opts "$0" "$*"
+    exec $AM_TEST_RUNNER_SHELL $opts "$0" ${1+"$@"}
+    # This should be dead code, unless some strange error happened.
+    echo "$0: failed to re-execute with $AM_TEST_RUNNER_SHELL" >&2
+    exit 99
     ;;
 esac
 
-# NOTE: From this point on, we can assume this file is being executed
-# by the configure-time detected $AM_TEST_RUNNER_SHELL.
-
-
-## ----------------------- ##
-##  Early debugging info.  ##
-## ----------------------- ##
-
-echo "Running from installcheck: $am_running_installcheck"
-echo "Using TAP: $am_using_tap"
-echo "PATH = $PATH"
-
-
-## ---------------------- ##
-##  Environment cleanup.  ##
-## ---------------------- ##
-
-# Temporarily disable this, since some shells (e.g., older version
-# of Bash) can return a non-zero exit status upon the when a non-set
-# variable is unset.
-set +e
-
-# Unset some make-related variables that may cause $MAKE to act like
-# a recursively invoked sub-make.  Any $MAKE invocation in a test is
-# conceptually an independent invocation, not part of the main
-# 'automake' build.
-unset MFLAGS MAKEFLAGS AM_MAKEFLAGS MAKELEVEL
-unset __MKLVL__ MAKE_JOBS_FIFO                     # For BSD make.
-unset DMAKE_CHILD DMAKE_DEF_PRINTED DMAKE_MAX_JOBS # For Solaris dmake.
-# Unset verbosity flag.
-unset V
-# Also unset variables that will let "make -e install" divert
-# files into unwanted directories.
-unset DESTDIR
-unset prefix exec_prefix bindir datarootdir datadir docdir dvidir
-unset htmldir includedir infodir libdir libexecdir localedir mandir
-unset oldincludedir pdfdir psdir sbindir sharedstatedir sysconfdir
-# Unset variables that might change the "make distcheck" behaviour.
-unset DISTCHECK_CONFIGURE_FLAGS AM_DISTCHECK_CONFIGURE_FLAGS
-# Used by install rules for info files.
-unset AM_UPDATE_INFO_DIR
-# The tests call "make -e" but we do not want $srcdir from the environment
-# to override the definition from the Makefile.
-unset srcdir
-# Also unset variables that control our test driver.  While not
-# conceptually independent, they cause some changed semantics we
-# need to control (and test for) in some of the tests to ensure
-# backward-compatible behavior.
-unset TESTS_ENVIRONMENT AM_TESTS_ENVIRONMENT
-unset DISABLE_HARD_ERRORS
-unset AM_COLOR_TESTS
-unset TESTS
-unset XFAIL_TESTS
-unset TEST_LOGS
-unset TEST_SUITE_LOG
-unset RECHECK_LOGS
-unset VERBOSE
-for pfx in TEST_ SH_ TAP_ ''; do
-  unset ${pfx}LOG_COMPILER
-  unset ${pfx}LOG_COMPILE # Not a typo!
-  unset ${pfx}LOG_FLAGS
-  unset AM_${pfx}LOG_FLAGS
-  unset ${pfx}LOG_DRIVER
-  unset ${pfx}LOG_DRIVER_FLAGS
-  unset AM_${pfx}LOG_DRIVER_FLAGS
-done
-unset pfx
-
-# Re-enable, it had been temporarily disabled above.
-set -e
-
-## ---------------------------- ##
-##  Auxiliary shell functions.  ##
-## ---------------------------- ##
-
-# Tell whether we should keep the test directories around, even in
-# case of success.  By default, we don't.
-am_keeping_testdirs ()
-{
-  case $keep_testdirs in
-     ""|n|no|NO) return 1;;
-              *) return 0;;
-  esac
-}
-
-# This is used in 'Exit' and in the exit trap.  See comments in the latter
-# for more information,
-am__test_skipped=no
-
-# We use a trap below for cleanup.  This requires us to go through
-# hoops to get the right exit status transported through the signal.
-# So use "Exit STATUS" instead of "exit STATUS" inside of the tests.
-# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
-# sh inside this function.
-Exit ()
-{
-  set +e
-  # See comments in the exit trap for the reason we do this.
-  test 77 = $1 && am__test_skipped=yes
-  (exit $1); exit $1
-}
-
-if test $am_using_tap = yes; then
-  am_funcs_file=tap-functions.sh
-else
-  am_funcs_file=plain-functions.sh
-fi
-
-if test -f "$am_testauxdir/$am_funcs_file"; then
-  . "$am_testauxdir/$am_funcs_file" || {
-    echo "$me: error sourcing $am_testauxdir/$am_funcs_file" >&2
-    Exit 99
-  }
-else
-  echo "$me: $am_testauxdir/$am_funcs_file not found" >&2
-  Exit 99
-fi
-unset am_funcs_file
-
-# cross_compiling
-# ---------------
-# Tell whether we are cross-compiling.  This is especially useful to skip
-# tests (or portions of them) that requires a native compiler.
-cross_compiling ()
-{
-  # Quoting from the autoconf manual:
-  #   ... [$host_alias and $build both] default to the result of running
-  #   config.guess, unless you specify either --build or --host.  In
-  #   this case, the default becomes the system type you specified.
-  #   If you specify both, *and they're different*, configure enters
-  #   cross compilation mode (so it doesn't run any tests that require
-  #   execution).
-  test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
-}
-
-# is_newest FILE FILES
-# --------------------
-# Return false if any file in FILES is newer than FILE.
-# Resolve ties in favor of FILE.
-is_newest ()
-{
-  is_newest_files=`find "$@" -prune -newer "$1"`
-  test -z "$is_newest_files"
-}
-
-# is_blocked_signal SIGNAL-NUMBER
-# --------------------------------
-# Return success if the given signal number is blocked in the shell,
-# return a non-zero exit status and print a proper diagnostic otherwise.
-is_blocked_signal ()
-{
-  # Use perl, since trying to do this portably in the shell can be
-  # very tricky, if not downright impossible.  For reference, see:
-  # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
-  if $PERL -w -e '
-    use strict;
-    use warnings FATAL => "all";
-    use POSIX;
-    my %oldsigaction = ();
-    sigaction('"$1"', 0, \%oldsigaction);
-    exit ($oldsigaction{"HANDLER"} eq "IGNORE" ? 0 : 77);
-  '; then
-    return 0
-  elif test $? -eq 77; then
-    return 1
-  else
-    fatal_ "couldn't determine whether signal $1 is blocked"
-  fi
-}
-
-# AUTOMAKE_run [-e STATUS] [-d DESCRIPTION] [--] [AUTOMAKE-ARGS...]
-# -----------------------------------------------------------------
-# Run automake with AUTOMAKE-ARGS, and fail if it doesn't exit with
-# STATUS.  Should be polymorphic for TAP and "plain" tests.  The
-# DESCRIPTION, when provided, is used for console reporting, only if
-# the TAP protocol is in use in the current test script.
-AUTOMAKE_run ()
-{
-  am__desc=
-  am__exp_rc=0
-  while test $# -gt 0; do
-    case $1 in
-      -d) am__desc=$2; shift;;
-      -e) am__exp_rc=$2; shift;;
-      --) shift; break;;
-       # Don't fail on unknown option: assume they (and the rest of the
-       # command line) are to be passed verbatim to automake (so stop our
-       # own option parsing).
-       *) break;;
-    esac
-    shift
-  done
-  am__got_rc=0
-  $AUTOMAKE ${1+"$@"} >stdout 2>stderr || am__got_rc=$?
-  cat stderr >&2
-  cat stdout
-  if test $am_using_tap != yes; then
-    test $am__got_rc -eq $am__exp_rc || Exit 1
-    return
-  fi
-  if test -z "$am__desc"; then
-    if test $am__got_rc -eq $am__exp_rc; then
-      am__desc="automake exited $am__got_rc"
-    else
-      am__desc="automake exited $am__got_rc, expecting $am__exp_rc"
-    fi
-  fi
-  command_ok_ "$am__desc" test $am__got_rc -eq $am__exp_rc
-}
-
-# AUTOMAKE_fails [-d DESCRIPTION] [OPTIONS...]
-# --------------------------------------------
-# Run automake with OPTIONS, and fail if doesn't exit with status 1.
-# Should be polymorphic for TAP and "plain" tests.  The DESCRIPTION,
-# when provided, is used for console reporting, only if the TAP
-# protocol is in use in the current test script.
-AUTOMAKE_fails ()
-{
-  AUTOMAKE_run -e 1 ${1+"$@"}
-}
-
-# extract_configure_help { --OPTION | VARIABLE-NAME } [FILES]
-# -----------------------------------------------------------
-# Use this to extract from the output of "./configure --help" (or similar)
-# the description or help message associated to the given --OPTION or
-# VARIABLE-NAME.
-extract_configure_help ()
-{
-  am__opt_re='' am__var_re=''
-  case $1 in
-    --*'=')   am__opt_re="^  $1";;
-    --*'[=]') am__opt_re='^  '`printf '%s\n' "$1" | sed 's/...$//'`'\[=';;
-    --*)      am__opt_re="^  $1( .*|$)";;
-      *)      am__var_re="^  $1( .*|$)";;
-  esac
-  shift
-  if test x"$am__opt_re" != x; then
-    LC_ALL=C awk '
-      /'"$am__opt_re"'/        { print; do_print = 1; next; }
-      /^$/                     { do_print = 0; next }
-      /^  --/                  { do_print = 0; next }
-      (do_print == 1)          { print }
-    ' ${1+"$@"}
-  else
-    LC_ALL=C awk '
-      /'"$am__var_re"'/        { print; do_print = 1; next; }
-      /^$/                     { do_print = 0; next }
-      /^  [A-Z][A-Z0-9_]* /    { do_print = 0; next }
-      /^  [A-Z][A-Z0-9_]*$/    { do_print = 0; next }
-      (do_print == 1)          { print }
-    ' ${1+"$@"}
-  fi
-}
-
-# grep_configure_help { --OPTION | VARIABLE-NAME } REGEXP
-# -------------------------------------------------------
-# Grep the section of "./configure --help" output associated with either
-# --OPTION or VARIABLE-NAME for the given *extended* regular expression.
-grep_configure_help ()
-{
-  ./configure --help > am--all-help \
-    || { cat am--all-help; Exit 1; }
-  cat am--all-help
-  extract_configure_help "$1" am--all-help > am--our-help \
-    || { cat am--our-help; Exit 1; }
-  cat am--our-help
-  $EGREP "$2" am--our-help || Exit 1
-}
-
-# using_gmake
-# -----------
-# Return success if $MAKE is GNU make, return failure otherwise.
-# Caches the result for speed reasons.
-using_gmake ()
-{
-  case $am__using_gmake in
-    yes)
-      return 0;;
-    no)
-      return 1;;
-    '')
-      # Use --version AND -v, because SGI Make doesn't fail on --version.
-      # Also grep for GNU because newer versions of FreeBSD make do
-      # not complain about --version (they seem to silently ignore it).
-      if $MAKE --version -v | grep GNU; then
-        am__using_gmake=yes
-        return 0
-      else
-        am__using_gmake=no
-        return 1
-      fi;;
-    *)
-      fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
-  esac
-}
-am__using_gmake="" # Avoid interferences from the environment.
-
-# make_can_chain_suffix_rules
-# ---------------------------
-# Return 0 if $MAKE is a make implementation that can chain suffix rules
-# automatically, return 1 otherwise.  Caches the result for speed reasons.
-make_can_chain_suffix_rules ()
-{
-  if test -z "$am__can_chain_suffix_rules"; then
-    if using_gmake; then
-      am__can_chain_suffix_rules=yes
-      return 0
-    else
-      mkdir am__chain.dir$$
-      cd am__chain.dir$$
-      unindent > Makefile << 'END'
-        .SUFFIXES: .u .v .w
-        .u.v: ; cp $< $@
-        .v.w: ; cp $< $@
-END
-      echo make can chain suffix rules > foo.u
-      if $MAKE foo.w && diff foo.u foo.w; then
-        am__can_chain_suffix_rules=yes
-      else
-        am__can_chain_suffix_rules=no
-      fi
-      cd ..
-      rm -rf am__chain.dir$$
-    fi
-  fi
-  case $am__can_chain_suffix_rules in
-    yes) return 0;;
-     no) return 1;;
-      *) fatal_ "make_can_chain_suffix_rules: internal error";;
-  esac
-}
-am__can_chain_suffix_rules="" # Avoid interferences from the environment.
-
-# useless_vpath_rebuild
-# ---------------------
-# Tell whether $MAKE suffers of the bug triggering automake bug#7884.
-# For example, this happens with FreeBSD make, since in a VPATH build
-# it tends to rebuilt files for which there is an explicit or even just
-# a suffix rule, even if said files are already available in the VPATH
-# directory.
-useless_vpath_rebuild ()
-{
-  if test -z "$am__useless_vpath_rebuild"; then
-    if using_gmake; then
-      am__useless_vpath_rebuild=no
-      return 1
-    fi
-    mkdir am__vpath.dir$$
-    cd am__vpath.dir$$
-    touch foo.a foo.b bar baz
-    mkdir build
-    cd build
-    unindent > Makefile << 'END'
-        .SUFFIXES: .a .b
-        VPATH = ..
-        all: foo.b baz
-        .PHONY: all
-        .a.b: ; cp $< $@
-        baz: bar ; cp ../baz bar
-END
-    if $MAKE all && test ! -f foo.b && test ! -f bar; then
-      am__useless_vpath_rebuild=no
-    else
-      am__useless_vpath_rebuild=yes
-    fi
-    cd ../..
-    rm -rf am__vpath.dir$$
-  fi
-  case $am__useless_vpath_rebuild in
-    yes) return 0;;
-     no) return 1;;
-     "") ;;
-      *) fatal_ "no_useless_builddir_remake: internal error";;
-  esac
-}
-am__useless_vpath_rebuild=""
-
-yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
-
-# seq_ - print a sequence of numbers
-# ----------------------------------
-# This function simulates GNU seq(1) portably.  Valid usages:
-#  - seq LAST
-#  - seq FIRST LAST
-#  - seq FIRST INCREMENT LAST
-seq_ ()
-{
-  case $# in
-    0) fatal_ "seq_: missing argument";;
-    1) seq_first=1  seq_incr=1  seq_last=$1;;
-    2) seq_first=$1 seq_incr=1  seq_last=$2;;
-    3) seq_first=$1 seq_incr=$2 seq_last=$3;;
-    *) fatal_ "seq_: too many arguments";;
-  esac
-  # Try to avoid forks if possible.
-  case "$BASH_VERSION" in
-    ""|[12].*)
-      : Not bash, or a too old bash version. ;;
-    *)
-      # Use eval to protect dumber shells from parsing errors.
-      eval 'for ((i = seq_first; i <= seq_last; i += seq_incr)); do
-              echo $i
-            done'
-      return 0;;
-  esac
-  # Else, use GNU seq if available.
-  seq "$@" && return 0
-  # Otherwise revert to a slower loop using expr(1).
-  i=$seq_first
-  while test $i -le $seq_last; do
-    echo $i
-    i=`expr $i + $seq_incr`
-  done
-}
-
-# rm_rf_ [FILES OR DIRECTORIES ...]
-# ---------------------------------
-# Recursively remove the given files or directory, also handling the case
-# of non-writable subdirectories.
-rm_rf_ ()
-{
-  test $# -gt 0 || return 0
-  # Ignore failures in find, we are only interested in failures of the
-  # final rm.
-  find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
-  rm -rf "$@"
-}
-
-# count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N
-# -----------------------------------------------------------------------
-# Check that a testsuite run driven by the parallel-tests harness has
-# had the specified numbers of test results (specified by kind).
-# This function assumes that the output of "make check" or "make recheck"
-# has been saved in the 'stdout' file in the current directory, and its
-# log in the 'test-suite.log' file.
-count_test_results ()
-{
-  # Use a subshell so that we won't pollute the script namespace.
-  (
-    # TODO: Do proper checks on the arguments?
-    total=ERR pass=ERR fail=ERR xpass=ERR xfail=ERR skip=ERR error=ERR
-    eval "$@"
-    # For debugging.
-    $EGREP -i '(total|x?pass|x?fail|skip|error)' stdout || :
-    rc=0
-    # Avoid spurious failures with shells with "overly sensible"
-    # errexit shell flag, such as e.g., Solaris /bin/sh.
-    set +e
-    test `grep -c '^PASS:'  stdout` -eq $pass  || rc=1
-    test `grep -c '^XFAIL:' stdout` -eq $xfail || rc=1
-    test `grep -c '^SKIP:'  stdout` -eq $skip  || rc=1
-    test `grep -c '^FAIL:'  stdout` -eq $fail  || rc=1
-    test `grep -c '^XPASS:' stdout` -eq $xpass || rc=1
-    test `grep -c '^ERROR:' stdout` -eq $error || rc=1
-    grep "^# TOTAL:  *$total$" stdout || rc=1
-    grep "^# PASS:  *$pass$"   stdout || rc=1
-    grep "^# XFAIL:  *$xfail$" stdout || rc=1
-    grep "^# SKIP:  *$skip$"   stdout || rc=1
-    grep "^# FAIL:  *$fail$"   stdout || rc=1
-    grep "^# XPASS:  *$xpass$" stdout || rc=1
-    grep "^# ERROR:  *$error$" stdout || rc=1
-    test $rc -eq 0
-  )
-}
-
-commented_sed_unindent_prog='
-  /^$/b                    # Nothing to do for empty lines.
-  x                        # Get x<indent> into pattern space.
-  /^$/{                    # No prior x<indent>, go prepare it.
-    g                      # Copy this 1st non-blank line into pattern space.
-    s/^\(['"$tab"' ]*\).*/x\1/   # Prepare x<indent> in pattern space.
-  }                        # Now: x<indent> in pattern and <line> in hold.
-  G                        # Build x<indent>\n<line> in pattern space, and
-  h                        # duplicate it into hold space.
-  s/\n.*$//                # Restore x<indent> in pattern space, and
-  x                        # exchange with the above duplicate in hold space.
-  s/^x\(.*\)\n\1//         # Remove leading <indent> from <line>.
-  s/^x.*\n//               # Restore <line> when there is no leading <indent>.
-'
-
-# unindent [input files...]
-# -------------------------
-# Remove the "proper" amount of leading whitespace from the given files,
-# and output the result on stdout.  That amount is determined by looking
-# at the leading whitespace of the first non-blank line in the input
-# files.  If no input file is specified, standard input is implied.
-unindent ()
-{
-  if test x"$sed_unindent_prog" = x; then
-    sed_unindent_prog=`printf '%s\n' "$commented_sed_unindent_prog" | sed -e 
"s/  *# .*//"`
-  fi
-  sed "$sed_unindent_prog" ${1+"$@"}
-}
-sed_unindent_prog="" # Avoid interferences from the environment.
-
-# get_shell_script SCRIPT-NAME
-# -----------------------------
-# Fetch an Automake-provided shell script from the 'lib/' directory into
-# the current directory, and, if the '$am_test_prefer_config_shell'
-# variable is set to "yes", modify its shebang line to use $SHELL instead
-# of /bin/sh.
-get_shell_script ()
-{
-  test ! -f "$1" || rm -f "$1" || return 99
-  if test x"$am_test_prefer_config_shell" = x"yes"; then
-    sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1" \
-     && chmod a+x "$1" \
-     || return 99
-  else
-    cp -f "$am_scriptdir/$1" . || return 99
-  fi
-  sed 10q "$1" # For debugging.
-}
-
-# require_xsi SHELL
-# -----------------
-# Skip the test if the given shell fails to support common XSI constructs.
-require_xsi ()
-{
-  test $# -eq 1 || fatal_ "require_xsi needs exactly one argument"
-  echo "$me: trying some XSI constructs with $1"
-  $1 -c "$xsi_shell_code" || skip_all_ "$1 lacks XSI features"
-}
-# Shell code supposed to work only with XSI shells.  Keep this in sync
-# with libtool.m4:_LT_CHECK_SHELL_FEATURES.
-xsi_shell_code='
-  _lt_dummy="a/b/c"
-  test 
"${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
-    && eval '\''test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5'\'
-
-# fetch_tap_driver
-# ----------------
-# Fetch the Automake-provided TAP driver from the 'lib/' directory into
-# the current directory, and edit its shebang line so that it will be
-# run with the perl interpreter determined at configure time.
-fetch_tap_driver ()
-{
-  # TODO: we should devise a way to make the shell TAP driver tested also
-  # TODO: with /bin/sh, for better coverage.
-  case $am_tap_implementation in
-    perl)
-      $PERL -MTAP::Parser -e 1 \
-        || skip_all_ "cannot import TAP::Parser perl module"
-      sed "1s|#!.*|#! $PERL -w|" "$am_scriptdir"/tap-driver.pl >tap-driver
-      ;;
-    shell)
-      AM_TAP_AWK=$AWK; export AM_TAP_AWK
-      sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh >tap-driver
-      ;;
-    *)
-      fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'" ;;
-  esac \
-    && chmod a+x tap-driver \
-    || framework_failure_ "couldn't fetch $am_tap_implementation TAP driver"
-  sed 10q tap-driver # For debugging.
-}
-# The shell/awk implementation of the TAP driver is still mostly dummy, so
-# use the perl implementation by default for the moment.
-am_tap_implementation=${am_tap_implementation-shell}
-
-# Usage: require_compiler_ {cc|c++|fortran|fortran77}
-require_compiler_ ()
-{
-  case $# in
-    0) fatal_ "require_compiler_: missing argument";;
-    1) ;;
-    *) fatal_ "require_compiler_: too many arguments";;
-  esac
-  case $1 in
-    cc)
-      am__comp_lang="C"
-      am__comp_var=CC
-      am__comp_flag_vars='CFLAGS CPPFLAGS'
-      ;;
-    c++)
-      am__comp_lang="C++"
-      am__comp_var=CXX
-      am__comp_flag_vars='CXXFLAGS CPPFLAGS'
-      ;;
-    fortran)
-      am__comp_lang="Fortran"
-      am__comp_var=FC
-      am__comp_flag_vars='FCFLAGS'
-      ;;
-    fortran77)
-      am__comp_lang="Fortran 77"
-      am__comp_var=F77
-      am__comp_flag_vars='FFLAGS'
-      ;;
-  esac
-  shift
-  eval "am__comp_prog=\${$am__comp_var}" \
-    || fatal_ "expanding \${$am__comp_var} in require_compiler_"
-  case $am__comp_prog in
-    "")
-      fatal_ "botched configuration: \$$am__comp_var is empty";;
-    false)
-      skip_all_ "no $am__comp_lang compiler available";;
-    autodetect|autodetected)
-      # Let the ./configure commands in the test script try to determine
-      # these automatically.
-      unset $am__comp_var $am__comp_flag_vars;;
-    *)
-      # Pre-set these for the ./configure commands in the test script.
-      export $am__comp_var $am__comp_flag_vars;;
-  esac
-  # Delete private variables.
-  unset am__comp_lang am__comp_prog am__comp_var am__comp_flag_vars
-}
-
-## ----------------------------------------------------------- ##
-##  Checks for required tools, and additional setups (if any)  ##
-##  required by them.                                          ##
-## ----------------------------------------------------------- ##
-
-# Performance tests must be enabled explicitly.
-case $argv0 in
-  */perf/*)
-    case $AM_TESTSUITE_PERF in
-      [yY]|[yY]es|1) ;;
-      *) skip_ "performance tests not explicitly enabled" ;;
-    esac
-    ;;
-esac
-
-# Look for (and maybe set up) required tools and/or system features; skip
-# the current test if they are not found.
-for tool in : $required
-do
-  # Check that each required tool is present.
-  case $tool in
-    :) ;;
-    cc|c++|fortran|fortran77)
-      require_compiler_ $tool;;
-    xsi-lib-shell)
-      if test x"$am_test_prefer_config_shell" = x"yes"; then
-        require_xsi "$SHELL"
-      else
-        require_xsi "/bin/sh"
-      fi
-      ;;
-    bzip2)
-      # Do not use --version, older versions bzip2 still tries to compress
-      # stdin.
-      echo "$me: running bzip2 --help"
-      bzip2 --help \
-        || skip_all_ "required program 'bzip2' not available"
-      ;;
-    cl)
-      CC=cl
-      # Don't export CFLAGS, as that could have been initialized to only
-      # work with the C compiler detected at configure time.  If the user
-      # wants CFLAGS to also influence 'cl', he can still export CFLAGS
-      # in the environment "by hand" before calling the testsuite.
-      export CC CPPFLAGS
-      echo "$me: running $CC -?"
-      $CC -? || skip_all_ "Microsoft C compiler '$CC' not available"
-      ;;
-    etags)
-      # Exuberant Ctags will create a TAGS file even
-      # when asked for --help or --version.  (Emacs's etags
-      # does not have such problem.)  Use -o /dev/null
-      # to make sure we do not pollute the build directory.
-      echo "$me: running etags --version -o /dev/null"
-      etags --version -o /dev/null \
-        || skip_all_ "required program 'etags' not available"
-      ;;
-    GNUmake)
-      for make_ in "$MAKE" gmake gnumake :; do
-        MAKE=$make_ am__using_gmake=''
-        test "$MAKE" =  : && break
-        echo "$me: determine whether $MAKE is GNU make"
-        # Don't use "&&" here, or a bug of 'set -e' present in some
-        # versions of the BSD shell will be triggered.  We add the
-        # dummy "else" branch for extra safety.
-        if using_gmake; then break; else :; fi
-      done
-      test "$MAKE" = : && skip_all_ "this test requires GNU make"
-      export MAKE
-      unset make_
-      ;;
-    gcj)
-      GCJ=$GNU_GCJ GCJFLAGS=$GNU_GCJFLAGS; export GCJ GCJFLAGS
-      test "$GCJ" = false && skip_all_ "GNU Java compiler unavailable"
-      : For shells with busted 'set -e'.
-      ;;
-    gcc)
-      CC=$GNU_CC CFLAGS=$GNU_CFLAGS; export CC CFLAGS CPPFLAGS
-      test "$CC" = false && skip_all_ "GNU C compiler unavailable"
-      : For shells with busted 'set -e'.
-      ;;
-    g++)
-      CXX=$GNU_CXX CXXFLAGS=$GNU_CXXFLAGS; export CXX CXXFLAGS CPPFLAGS
-      test "$CXX" = false && skip_all_ "GNU C++ compiler unavailable"
-      : For shells with busted 'set -e'.
-      ;;
-    gfortran)
-      FC=$GNU_FC FCFLAGS=$GNU_FCFLAGS; export FC FCFLAGS
-      test "$FC" = false && skip_all_ "GNU Fortran compiler unavailable"
-      case " $required " in
-        *\ g77\ *) ;;
-        *) F77=$FC FFLAGS=$FCFLAGS; export F77 FFLAGS;;
-      esac
-      ;;
-    g77)
-      F77=$GNU_F77 FFLAGS=$GNU_FFLAGS; export F77 FFLAGS
-      test "$F77" = false && skip_all_ "GNU Fortran 77 compiler unavailable"
-      case " $required " in
-        *\ gfortran\ *) ;;
-        *) FC=$F77 FCFLAGS=$FFLAGS; export FC FCFLAGS;;
-      esac
-      ;;
-    javac)
-      # The Java compiler from JDK 1.5 (and presumably earlier versions)
-      # cannot handle the '-version' option by itself: it bails out
-      # telling that source files are missing.  Adding also the '-help'
-      # option seems to solve the problem.
-      echo "$me: running javac -version -help"
-      javac -version -help || skip_all_ "Sun Java compiler not available"
-      ;;
-    java)
-      # See the comments above about 'javac' for why we use also '-help'.
-      echo "$me: running java -version -help"
-      java -version -help || skip_all_ "Sun Java interpreter not found"
-      ;;
-    lib)
-      AR=lib
-      export AR
-      # Attempting to create an empty archive will actually not
-      # create the archive, but lib will output its version.
-      echo "$me: running $AR -out:defstest.lib"
-      $AR -out:defstest.lib \
-        || skip_all_ "Microsoft 'lib' utility not available"
-      ;;
-    makedepend)
-      echo "$me: running makedepend -f-"
-      makedepend -f- \
-        || skip_all_ "required program 'makedepend' not available"
-      ;;
-    mingw)
-      uname_s=`uname -s || echo UNKNOWN`
-      echo "$me: system name: $uname_s"
-      case $uname_s in
-        MINGW*) ;;
-        *) skip_all_ "this test requires MSYS in MinGW mode" ;;
-      esac
-      ;;
-    non-root)
-      # Skip this test case if the user is root.
-      # We try to append to a read-only file to detect this.
-      priv_check_temp=priv-check.$$
-      touch $priv_check_temp && chmod a-w $priv_check_temp \
-        || framework_failure_ "creating unwritable file $priv_check_temp"
-      # Not a useless use of subshell: lesser shells like Solaris /bin/sh
-      # can exit if a builtin fails.
-      overwrite_status=0
-      (echo foo >> $priv_check_temp) || overwrite_status=$?
-      rm -f $priv_check_temp
-      if test $overwrite_status -eq 0; then
-        skip_all_ "cannot drop file write permissions"
-      fi
-      unset priv_check_temp overwrite_status
-      ;;
-    perl-threads)
-      if test "$WANT_NO_THREADS" = "yes"; then
-        skip_all_ "Devel::Cover cannot cope with threads"
-      fi
-      ;;
-    native)
-      # Don't use "&&" here, to avoid a bug of 'set -e' present in
-      # some (even relatively recent) versions of the BSD shell.
-      # We add the dummy "else" branch for extra safety.
-      if cross_compiling; then
-        skip_all_ "doesn't work in cross-compile mode"
-      else :; fi
-      ;;
-    python)
-      # Python doesn't support --version, it has -V
-      echo "$me: running python -V"
-      python -V || skip_all_ "python interpreter not available"
-      ;;
-    ro-dir)
-      # Skip this test case if read-only directories aren't supported
-      # (e.g., under DOS.)
-      ro_dir_temp=ro_dir.$$
-      mkdir $ro_dir_temp && chmod a-w $ro_dir_temp \
-        || framework_failure_ "creating unwritable directory $ro_dir_temp"
-      # Not a useless use of subshell: lesser shells like Solaris /bin/sh
-      # can exit if a builtin fails.
-      create_status=0
-      (: > $ro_dir_temp/probe) || create_status=$?
-      rm -rf $ro_dir_temp
-      if test $create_status -eq 0; then
-        skip_all_ "cannot drop directory write permissions"
-      fi
-      unset ro_dir_temp create_status
-      ;;
-    runtest)
-      # DejaGnu's runtest program. We rely on being able to specify
-      # the program on the runtest command-line. This requires
-      # DejaGnu 1.4.3 or later.
-      echo "$me: running runtest SOMEPROGRAM=someprogram --version"
-      runtest SOMEPROGRAM=someprogram --version \
-        || skip_all_ "DejaGnu is not available"
-      ;;
-    tex)
-      # No all versions of Tex support '--version', so we use
-      # a configure check.
-      if test -z "$TEX"; then
-        skip_all_ "TeX is required, but it wasn't found by configure"
-      fi
-      ;;
-    lex)
-      test x"$LEX" = x"false" && skip_all_ "lex not found or disabled"
-      export LEX
-      ;;
-    yacc)
-      test x"$YACC" = x"false" && skip_all_ "yacc not found or disabled"
-      export YACC
-      ;;
-    flex)
-      LEX=flex; export LEX
-      echo "$me: running flex --version"
-      flex --version || skip_all_ "required program 'flex' not available"
-      ;;
-    bison)
-      YACC='bison -y'; export YACC
-      echo "$me: running bison --version"
-      bison --version || skip_all_ "required program 'bison' not available"
-      ;;
-    *)
-      # Generic case: the tool must support --version.
-      echo "$me: running $tool --version"
-      # It is not likely but possible that $tool is a special builtin,
-      # in which case the shell is allowed to exit after an error.  So
-      # we need the subshell here.  Also, some tools, like Sun cscope,
-      # can be interactive without redirection.
-      ($tool --version) </dev/null \
-        || skip_all_ "required program '$tool' not available"
-      ;;
-  esac
-done
-
-# Using just $am_top_builddir for the check here is ok, since the
-# further temporary subdirectory where the test will be run is
-# ensured not to contain any whitespace character.
-case $am_top_builddir in
-  *\ *|*\      *)
-    case " $required " in
-      *' libtool '* | *' libtoolize '* )
-        skip_all_ "libtool has problems with spaces in builddir name";;
-    esac
-    ;;
-esac
-
-# This test is necessary, although Automake's configure script bails out
-# when $srcdir contains spaces.  This is because $am_top_srcdir is in not
-# configure-time $srcdir, but is instead configure-time $abs_srcdir, and
-# that is allowed to contain spaces.
-case $am_top_srcdir in
-  *\ * |*\     *)
-    case " $required " in
-      *' libtool '* | *' libtoolize '* | *' gettext '* )
-        skip_all_ "spaces in srcdir name: libtool/gettext tests won't work";;
-   esac
-   ;;
-esac
-
-# We might need extra macros, e.g., from Libtool or Gettext.
-case " $required " in *\ libtool*) . ./t/libtool-macros.dir/get.sh;; esac
-case " $required " in *\ gettext*) . ./t/gettext-macros.dir/get.sh;; esac
-
-
-## ---------------------------------------------------------------- ##
-##  Create and set up of the temporary directory used by the test.  ##
-##  Set up of the exit trap for cleanup of said directory.          ##
-## ---------------------------------------------------------------- ##
-
-# This might be used in testcases checking distribution-related features.
-# Test scripts are free to override this if they need to.
-distdir=$me-1.0
-
-# Set up the exit trap.
-trap 'exit_status=$?
-  set +e
-  cd "$am_top_builddir"
-  if test $am_using_tap = yes; then
-    if test "$planned_" = later && test $exit_status -eq 0; then
-      plan_ "now"
-    fi
-    test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
-      || keep_testdirs=yes
-  else
-    # This is to ensure that a test script does give a SKIP outcome just
-    # because a command in it happens to exit with status 77.  This
-    # behaviour, while from time to time useful to developers, is not
-    # meant to be enabled by default, as it could cause spurious failures
-    # in the wild.  Thus it will be enabled only when the variable
-    # "am_explicit_skips" is set to a "true" value.
-    case $am_explicit_skips in
-      [yY]|[yY]es|1)
-        if test $exit_status -eq 77 && test $am__test_skipped != yes; then
-          echo "$me: implicit skip turned into failure"
-          exit_status=78
-        fi;;
-    esac
-    test $exit_status -eq 0 || keep_testdirs=yes
-  fi
-  am_keeping_testdirs || rm_rf_ $testSubDir
-  set +x
-  echo "$me: exit $exit_status"
-  exit $exit_status
-' 0
-trap "fatal_ 'caught signal SIGHUP'" 1
-trap "fatal_ 'caught signal SIGINT'" 2
-trap "fatal_ 'caught signal SIGTERM'" 15
-# Various shells seems to just ignore SIGQUIT under some circumstances,
-# even if the signal is not blocked; however, if the signal it trapped,
-# the trap gets correctly executed.  So we also trap SIGQUIT.
-# Here is a list of some shells that have been verified to exhibit the
-# problematic behavior with SIGQUIT:
-#  - zsh 4.3.12 on Debian GNU/Linux
-#  - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
-#  - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
-#  - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
-# OTOH, at least these shells that do *not* exhibit that behaviour:
-#  - modern version of the Almquist Shell (at least 0.5.5.1), on
-#    both Solaris and GNU/Linux
-#  - Solaris 10 /bin/sh
-#  - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
-trap "fatal_ 'caught signal SIGQUIT'" 3
-# Ignore further SIGPIPE in the trap code.  This is required to avoid
-# a very weird issue with some shells, at least when the execution of
-# the automake testsuite is driven by the 'prove' utility: if prove
-# (or the make process that has spawned it) gets interrupted with
-# Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
-# sometimes finally dumping core, other times hanging indefinitely.
-# See also Test::Harness bug [rt.cpan.org #70855], archived at
-# <https://rt.cpan.org/Ticket/Display.html?id=70855>
-trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
-
-# Create and populate the temporary directory, if and as required.
-if test x"$am_create_testdir" = x"no"; then
-  testSubDir=
-else
-  # The subdirectory where the current test script will run and write its
-  # temporary/data files.  This will be created shortly, and will be removed
-  # by the cleanup trap below if the test passes.  If the test doesn't pass,
-  # this directory will be kept, to facilitate debugging.
-  testSubDir=t/$me.dir
-  test ! -d $testSubDir || rm_rf_ $testSubDir \
-    || framework_failure_ "removing old test subdirectory"
-  test -d t || mkdir t
-  mkdir $testSubDir \
-    || framework_failure_ "creating test subdirectory"
-  # The trailing './'ris to avoid CDPATH issues.
-  cd ./$testSubDir \
-    || framework_failure_ "cannot chdir into test subdirectory"
-  if test x"$am_create_testdir" != x"empty"; then
-    cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
-       "$am_scriptdir"/depcomp . \
-      || framework_failure_ "fetching common files from $am_scriptdir"
-    # Build appropriate environment in test directory.  E.g., create
-    # configure.ac, touch all necessary files, etc.  Don't use AC_OUTPUT,
-    # but AC_CONFIG_FILES so that appending still produces a valid
-    # configure.ac.  But then, tests running config.status really need
-    # to append AC_OUTPUT.
-    {
-      echo "AC_INIT([$me], [1.0])"
-      if test x"$am_serial_tests" = x"yes"; then
-        echo "AM_INIT_AUTOMAKE([serial-tests])"
-      else
-        echo "AM_INIT_AUTOMAKE"
-      fi
-      echo "AC_CONFIG_FILES([Makefile])"
-    } >configure.ac || framework_failure_ "creating configure.ac skeleton"
-  fi
-fi
-
-
-## ---------------- ##
-##  Ready to go...  ##
-## ---------------- ##
-
-set -x
-pwd
+# Source the actual test initialization and setup code, and return
+# control to the test script that is sourcing us.
+. "$am_testauxdir/test-init.sh"
diff --git a/syntax-checks.mk b/syntax-checks.mk
index 99a0946..d9302da 100644
--- a/syntax-checks.mk
+++ b/syntax-checks.mk
@@ -31,7 +31,7 @@ xtests := $(shell \
      done; \
    done | sort)
 
-xdefs = $(srcdir)/defs $(srcdir)/defs-static.in
+xdefs = $(srcdir)/t/ax/test-init.sh $(srcdir)/defs $(srcdir)/defs-static.in
 
 ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print)
 
@@ -63,6 +63,7 @@ sc_tests_automake_fails \
 sc_tests_required_after_defs \
 sc_tests_overriding_macros_on_cmdline \
 sc_tests_plain_sleep \
+sc_tests_ls_t \
 sc_m4_am_plain_egrep_fgrep \
 sc_tests_no_configure_in \
 sc_tests_PATH_SEPARATOR \
@@ -366,6 +367,16 @@ sc_tests_overriding_macros_on_cmdline:
          exit 1; \
        fi
 
+## Prefer use of our 'is_newest' auxiliary script over the more hacky
+## idiom "test $(ls -1t new old | sed 1q) = new", which is both more
+## cumbersome and more fragile.
+sc_tests_ls_t:
+       @if LC_ALL=C grep -E '\bls(\s+-[a-zA-Z0-9]+)*\s+-[a-zA-Z0-9]*t' \
+           $(xtests); then \
+         echo "Use 'is_newest' rather than hacks based on 'ls -t'" 1>&2; \
+         exit 1; \
+       fi
+
 ## Never use 'sleep 1' to create files with different timestamps.
 ## Use '$sleep' instead.  Some filesystems (e.g., Windows) have only
 ## a 2sec resolution.
diff --git a/t/README b/t/README
index 5f967d2..57cab89 100644
--- a/t/README
+++ b/t/README
@@ -278,6 +278,22 @@ Do
 Do not
 ------
 
+  In test scripts, prefer using POSIX constructs over their old
+  Bourne-only equivalents:
+
+    - use $(...), not `...`, for command substitution;
+    - use $((...), not `expr ...`, for arithmetic processing;
+    - liberally use '!' to invert the exit status of a command, e.g.,
+      in idioms like "if ! CMD; then ...", instead of relying on clumsy
+      paraphrases like "if CMD; then :; else ...".
+    - prefer use of ${param%pattern} and ${param#pattern} parameter
+      expansions over processing by 'sed' or 'expr'.
+  
+  Note however that, when writing Makefile recipes or shell code in a
+  configure.ac, you should still use `...` instead, because the Autoconf
+  generated configure scripts do not ensure they will find a truly POSIX
+  shell (even though they will prefer and use it *if* it's found).
+
   Do not test an Automake error with "$AUTOMAKE && Exit 1", or in three
   years we'll discover that this test failed for some other bogus reason.
   This happened many times.  Better use something like
diff --git a/t/ac-output-old.tap b/t/ac-output-old.tap
index 7a4d762..f7bcc8f 100755
--- a/t/ac-output-old.tap
+++ b/t/ac-output-old.tap
@@ -141,7 +141,7 @@ mkdir subdir
 command_ok_ "aclocal and AC_OUTPUT ($cur)" $ACLOCAL
 command_ok_ "automake and AC_OUTPUT ($cur)" $AUTOMAKE
 command_ok_ "foo.in mentioned two times in Makefile.in ($cur)" \
-             test `$FGREP foo.in Makefile.in | wc -l` -eq 2
+             test $($FGREP -c 'foo.in' Makefile.in) -eq 2
 
 # This ought to work as well.
 command_ok_ "'automake -a -f' and AC_OUTPUT ($cur)" \
diff --git a/t/acloca13.sh b/t/acloca13.sh
index e91a534..6d6f6c0 100755
--- a/t/acloca13.sh
+++ b/t/acloca13.sh
@@ -59,11 +59,12 @@ grep version1 aclocal.m4
 $sleep
 # aclocal.m4 should change if we touch otherfile.m4
 touch m4/otherfile.m4
-$sleep
 $ACLOCAL -I m4
-test `ls -1t aclocal.m4 m4/otherfile.m4 | sed 1q` = aclocal.m4
+is_newest aclocal.m4 m4/otherfile.m4
 
 $AUTOCONF
 $AUTOMAKE
 ./configure
 $MAKE distcheck
+
+:
diff --git a/t/acloca14.sh b/t/acloca14.sh
index ba1f072..2ba8b78 100755
--- a/t/acloca14.sh
+++ b/t/acloca14.sh
@@ -81,31 +81,21 @@ $AUTOMAKE
 ./configure
 $MAKE testdist1
 
-cp aclocal.m4 stamp
+cp aclocal.m4 aclocal.old
 $sleep
-
-cat >>c.m4 <<\EOF
-AC_DEFUN([FOO], [ANOTHER_MACRO])
-EOF
-
+echo 'AC_DEFUN([FOO], [ANOTHER_MACRO])' >> c.m4
 $MAKE
-
 # Because c.m4 has changed, aclocal.m4 must have been rebuilt.
-test `ls -1t aclocal.m4 stamp | sed 1q` = aclocal.m4
+is_newest aclocal.m4 aclocal.old
 # However, since FOO is not used, f.m4 should not be included
 # and the contents of aclocal.m4 should remain the same
-diff aclocal.m4 stamp
+diff aclocal.m4 aclocal.old
 
-# If FOO where to be used, that would be another story, of course.
-cat >>configure.ac <<EOF
-FOO
-EOF
-
-cp aclocal.m4 stamp
+# If FOO where to be used, that would be another story, of course:
+# f.m4 should be included
 $sleep
-
+echo FOO >> configure.ac
 $MAKE
-
 $FGREP defs/f.m4 aclocal.m4
 $MAKE testdist2
 
diff --git a/t/acloca15.sh b/t/acloca15.sh
index 690c06c..01d11de 100755
--- a/t/acloca15.sh
+++ b/t/acloca15.sh
@@ -42,6 +42,6 @@ $ACLOCAL -I m4
 $FGREP AM_SOME_MACRO aclocal.m4 && Exit 1
 $FGREP AM_MORE_MACRO aclocal.m4 && Exit 1
 $FGREP 'm4_include([m4/more.m4])' aclocal.m4
-test 1 = `grep m4_include aclocal.m4 | wc -l`
+test 1 = $(grep m4_include aclocal.m4 | wc -l)
 
 :
diff --git a/t/acloca18.sh b/t/acloca18.sh
index c0510e1..4ae03ff 100755
--- a/t/acloca18.sh
+++ b/t/acloca18.sh
@@ -128,7 +128,7 @@ grep 'installing.*4/m1\.m4' stderr
 
 $ACLOCAL -I 5 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
-test `grep -c 'ill-formed serial' stderr` -eq 3
+test $(grep -c 'ill-formed serial' stderr) -eq 3
 
 $ACLOCAL -I 6 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
diff --git a/t/aclocal-install-absdir.sh b/t/aclocal-install-absdir.sh
index b07f7fa..1c9938e 100755
--- a/t/aclocal-install-absdir.sh
+++ b/t/aclocal-install-absdir.sh
@@ -26,7 +26,7 @@ mkdir loc sys
 echo 'AM_DUMMY_MACRO' >> configure.ac
 echo 'AC_DEFUN([AM_DUMMY_MACRO], [:])' >> sys/foo.m4
 
-cwd=`pwd` || fatal_ "cannot get current working directory"
+cwd=$(pwd) || fatal_ "cannot get current working directory"
 env ACLOCAL_PATH="$cwd/sys" $ACLOCAL --verbose --install -I "$cwd/loc"
 diff sys/foo.m4 loc/foo.m4
 
diff --git a/t/aclocal-install-mkdir.sh b/t/aclocal-install-mkdir.sh
index ba4be2a..86cf803 100755
--- a/t/aclocal-install-mkdir.sh
+++ b/t/aclocal-install-mkdir.sh
@@ -36,7 +36,7 @@ ACLOCAL="$ACLOCAL --system-acdir=sys-acdir"
 $ACLOCAL -I foo --install
 test -f foo/my-defs.m4
 
-$ACLOCAL --install -I "`pwd`/bar"
+$ACLOCAL --install -I "$(pwd)/bar"
 test -f bar/my-defs.m4
 
 $ACLOCAL --install -I baz/sub/sub2
@@ -54,10 +54,10 @@ ls zardoz2 | grep . && Exit 1
 
 # Directories in ACLOCAL_PATH should never be created if they don't
 # exist.
-ACLOCAL_PATH="`pwd`/none:`pwd`/none2" $ACLOCAL --install && Exit 1
+ACLOCAL_PATH="$(pwd)/none:$(pwd)/none2" $ACLOCAL --install && Exit 1
 test ! -d none
 test ! -d none2
-ACLOCAL_PATH="`pwd`/none:`pwd`/none2" $ACLOCAL --install -I x
+ACLOCAL_PATH="$(pwd)/none:$(pwd)/none2" $ACLOCAL --install -I x
 test -f x/my-defs.m4
 test ! -d none
 test ! -d none2
diff --git a/t/aclocal-path-install-serial.sh b/t/aclocal-path-install-serial.sh
index 8a2b22c..c238a78 100755
--- a/t/aclocal-path-install-serial.sh
+++ b/t/aclocal-path-install-serial.sh
@@ -57,7 +57,7 @@ win ()
 
 mkdir sdir pdir m4
 
-ACLOCAL="$ACLOCAL --system-acdir=`pwd`/sdir"
+ACLOCAL="$ACLOCAL --system-acdir=$(pwd)/sdir"
 ACLOCAL_PATH=./pdir; export ACLOCAL_PATH
 
 cat > sdir/foo.m4 << 'END'
diff --git a/t/aclocal-path-install.sh b/t/aclocal-path-install.sh
index a9a8b97..71d718c 100755
--- a/t/aclocal-path-install.sh
+++ b/t/aclocal-path-install.sh
@@ -26,7 +26,7 @@ END
 
 mkdir acdir pdir ldir
 
-ACLOCAL="$ACLOCAL --system-acdir=`pwd`/acdir"
+ACLOCAL="$ACLOCAL --system-acdir=$(pwd)/acdir"
 ACLOCAL_PATH=./pdir; export ACLOCAL_PATH
 
 cat > acdir/foo.m4 << 'END'
diff --git a/t/aclocal-path-nonexistent.sh b/t/aclocal-path-nonexistent.sh
index 8c42ddc..3eb042a 100755
--- a/t/aclocal-path-nonexistent.sh
+++ b/t/aclocal-path-nonexistent.sh
@@ -27,7 +27,7 @@ END
 mkdir mdir
 echo 'AC_DEFUN([AM_FOO], [am--foo])' > mdir/foo.m4
 
-ACLOCAL_PATH=./nonesuch:./mdir:`pwd`/nonesuch2:nonesuch3 $ACLOCAL
+ACLOCAL_PATH=./nonesuch:./mdir:$(pwd)/nonesuch2:nonesuch3 $ACLOCAL
 $AUTOCONF
 $FGREP 'am--foo' configure
 
diff --git a/t/aclocal-path.sh b/t/aclocal-path.sh
index d1279f0..72b3938 100755
--- a/t/aclocal-path.sh
+++ b/t/aclocal-path.sh
@@ -40,7 +40,7 @@ cat > mdir3/baz.m4 << 'END'
 AC_DEFUN([AM_BAZ_MACRO], [am--baz])
 END
 
-ACLOCAL_PATH=mdir1:./mdir2:`pwd`/mdir3 $ACLOCAL
+ACLOCAL_PATH=mdir1:./mdir2:$(pwd)/mdir3 $ACLOCAL
 $AUTOCONF
 
 # there should be no m4_include in aclocal.m4, even though ACLOCAL_PATH
diff --git a/t/aclocal-print-acdir.sh b/t/aclocal-print-acdir.sh
index 53ad556..6e8aa09 100755
--- a/t/aclocal-print-acdir.sh
+++ b/t/aclocal-print-acdir.sh
@@ -20,12 +20,12 @@ am_create_testdir=empty
 . ./defs || Exit 1
 
 $ACLOCAL --print-ac-dir
-test "`$ACLOCAL --print-ac-dir`" = "$am_system_acdir"
+test "$($ACLOCAL --print-ac-dir)" = "$am_system_acdir"
 
 $ACLOCAL --system-acdir /bar --print-ac-dir
-test "`$ACLOCAL --system-acdir /bar --print-ac-dir`" = /bar
+test "$($ACLOCAL --system-acdir /bar --print-ac-dir)" = /bar
 
 $ACLOCAL --automake-acdir /bar --print-ac-dir
-test "`$ACLOCAL --automake-acdir /bar --print-ac-dir`" = "$am_system_acdir"
+test "$($ACLOCAL --automake-acdir /bar --print-ac-dir)" = "$am_system_acdir"
 
 :
diff --git a/t/aclocal7.sh b/t/aclocal7.sh
index 548d890..936d4ea 100755
--- a/t/aclocal7.sh
+++ b/t/aclocal7.sh
@@ -37,70 +37,64 @@ END
 mkdir m4
 echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
 
-$sleep
-
-$ACLOCAL -I m4
-
 # Automake will take aclocal.m4 to be newer if it has the same timestamp
 # as Makefile.in.  Avoid the confusing by sleeping.
-$sleep
-
-$AUTOMAKE --no-force
+AUTOMAKE_after_aclocal ()
+{
+  $sleep
+  $AUTOMAKE --no-force
+}
 
-$sleep
+$ACLOCAL -I m4
+AUTOMAKE_after_aclocal
 
 touch foo
+$sleep
 $ACLOCAL -I m4
-$AUTOMAKE --no-force
-
+AUTOMAKE_after_aclocal
 # aclocal.m4 and Makefile.in should not have been updated, so 'foo'
 # should be younger
-test `ls -1t aclocal.m4 Makefile.in sub/Makefile.in foo | sed 1q` = foo
+is_newest foo aclocal.m4 Makefile.in sub/Makefile.in
 
 $sleep
 $ACLOCAL -I m4 --force
-test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4
+is_newest aclocal.m4 foo
 # We still use --no-force for automake, but since aclocal.m4 has
 # changed all Makefile.ins should be updated.
-$sleep
-$AUTOMAKE --no-force
-test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
-test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
+AUTOMAKE_after_aclocal
+is_newest Makefile.in aclocal.m4 foo
+is_newest sub/Makefile.in aclocal.m4 foo
 
-touch m4/somedefs.m4
 $sleep
-touch foo
+touch m4/somedefs.m4
 $sleep
 $ACLOCAL -I m4
-$sleep
-$AUTOMAKE --no-force
-
-# aclocal.m4 should have been updated, although its contents haven't changed.
-test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4
-test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
-test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
+AUTOMAKE_after_aclocal
+# aclocal.m4 should have been updated, although its contents haven't
+# changed.
+is_newest aclocal.m4 m4/somedefs.m4
+is_newest Makefile.in m4/somedefs.m4
+is_newest sub/Makefile.in m4/somedefs.m4
 
-touch fragment.inc
 $sleep
-touch foo
+touch fragment.inc
 $sleep
 $ACLOCAL -I m4
-$AUTOMAKE --no-force
+AUTOMAKE_after_aclocal
 # Only ./Makefile.in should change.
-test `ls -1t aclocal.m4 foo | sed 1q` = foo
-test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
-test `ls -1t sub/Makefile.in foo | sed 1q` = foo
+is_newest Makefile.in fragment.inc
+is_newest fragment.inc aclocal.m4
+is_newest fragment.inc sub/Makefile.in
 
 grep README Makefile.in && Exit 1
 
-: > README
 $sleep
-touch foo
+: > README
 $sleep
 $AUTOMAKE --no-force
 # Even if no dependency change, the content changed.
-test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
-test `ls -1t sub/Makefile.in foo | sed 1q` = foo
+is_newest Makefile.in README
+is_newest README sub/Makefile.in
 
 grep README Makefile.in
 
@@ -111,6 +105,8 @@ $sleep
 $ACLOCAL -I m4
 $AUTOMAKE --no-force
 # Only sub/Makefile.in should change.
-test `ls -1t aclocal.m4 foo | sed 1q` = foo
-test `ls -1t Makefile.in foo | sed 1q` = foo
-test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
+is_newest foo aclocal.m4
+is_newest foo Makefile.in
+is_newest sub/Makefile.in foo
+
+:
diff --git a/t/aclocal8.sh b/t/aclocal8.sh
index 8df0835..869969e 100755
--- a/t/aclocal8.sh
+++ b/t/aclocal8.sh
@@ -35,7 +35,7 @@ echo 'AC_DEFUN([MACRO1],)' >m4/macro1.m4
 echo 'AC_DEFUN([MACRO2], [AC_REQUIRE([AM_UNUSED_MACRO])])' >m4/macro2.m4
 
 $ACLOCAL -I m4 >output 2>&1 || { cat output; Exit 1; }
-test 0 = `wc -l <output`
+test 0 -eq $(wc -l <output)
 grep macro1.m4 aclocal.m4
 grep macro2.m4 aclocal.m4 && Exit 1
 
diff --git a/t/add-missing.tap b/t/add-missing.tap
index 39b7ae7..6f16a0a 100755
--- a/t/add-missing.tap
+++ b/t/add-missing.tap
@@ -25,7 +25,7 @@ am_create_testdir=empty
 plan_ "later"
 
 build_aux=build-aux
-ocwd=`pwd` || fatal_ "cannot get current working directory"
+ocwd=$(pwd) || fatal_ "cannot get current working directory"
 
 # Try to improve readability of displayed diffs.
 if diff -u /dev/null /dev/null; then
@@ -79,7 +79,7 @@ check_count=0
 check_ ()
 {
   set +x # Temporary disable shell traces to remove noise from log files.
-  incr_ check_count
+  check_count=$(($check_count + 1))
   echo check count: $check_count
   override=no
   run_aclocal=no
@@ -280,7 +280,7 @@ END
 
 # For config.guess and config.sub.
 for mach in build host target system; do
-  MACH=`echo "$mach" | LC_ALL=C tr '[a-z]' '[A-Z]'`
+  MACH=$(echo "$mach" | LC_ALL=C tr '[a-z]' '[A-Z]')
   check_ <<END
 == Name ==
 cfg-$mach
diff --git a/t/amhello-binpkg.sh b/t/amhello-binpkg.sh
index 4b3e0e2..16fdfc3 100755
--- a/t/amhello-binpkg.sh
+++ b/t/amhello-binpkg.sh
@@ -28,12 +28,12 @@ cd amhello-1.0
 
 ./configure --prefix /usr
 $MAKE
-$MAKE DESTDIR="`pwd`/inst" install
+$MAKE DESTDIR="$(pwd)/inst" install
 cd inst
 find . -type f -print > ../files.lst
-tar cvf amhello-1.0-i686.tar.gz `cat ../files.lst` > tar.got 2>&1
+tar cvf amhello-1.0-i686.tar.gz $(cat ../files.lst) > tar.got 2>&1
 
-EXEEXT=`sed -n -e 's/^EXEEXT *= *//p' < ../Makefile`
+EXEEXT=$(sed -n -e 's/^EXEEXT *= *//p' < ../Makefile)
 
 if tar --version </dev/null | grep GNU; then
   LC_ALL=C sort tar.got > t
diff --git a/t/amhello-cross-compile.sh b/t/amhello-cross-compile.sh
index b138d87..26093cf 100755
--- a/t/amhello-cross-compile.sh
+++ b/t/amhello-cross-compile.sh
@@ -25,7 +25,7 @@ cp "$am_docdir"/amhello-1.0.tar.gz . \
   || fatal_ "cannot get amhello tarball"
 
 host=i586-mingw32msvc
-build=`"$am_scriptdir"/config.guess` && test -n "$build" \
+build=$("$am_scriptdir"/config.guess) && test -n "$build" \
   || fatal_ "cannot guess build platform"
 case $build in *mingw*) skip_ "build system is MinGW too";; esac
 
diff --git a/t/ar-lib.sh b/t/ar-lib.sh
index 1ddec64..1d6b588 100755
--- a/t/ar-lib.sh
+++ b/t/ar-lib.sh
@@ -37,77 +37,77 @@ END
 chmod +x ./lib
 
 # Check if ar-lib can create an archive with "cr".
-opts=`./ar-lib ./lib cr foo.lib foo.obj`
+opts=$(./ar-lib ./lib cr foo.lib foo.obj)
 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.obj"
 
 # Check if ar-lib can update an existing archive with "r".
 touch foo.lib
-opts=`./ar-lib ./lib r foo.lib foo.obj`
+opts=$(./ar-lib ./lib r foo.lib foo.obj)
 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
 
 # Check if ar-lib can update an existing archive with "q".
-opts=`./ar-lib ./lib q foo.lib foo.obj`
+opts=$(./ar-lib ./lib q foo.lib foo.obj)
 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
 
 # Check if ar-lib accepts "u" as a modifier.
 # NOTE: "u" should have an effect, but currently doesn't.
-opts=`./ar-lib ./lib ru foo.lib foo.obj`
+opts=$(./ar-lib ./lib ru foo.lib foo.obj)
 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
 
 # Check if ar-lib accepts "s" as a modifier.
-opts=`./ar-lib ./lib rs foo.lib foo.obj`
+opts=$(./ar-lib ./lib rs foo.lib foo.obj)
 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
 
 # Check if ar-lib accepts "S" as a modifier.
-opts=`./ar-lib ./lib rS foo.lib foo.obj`
+opts=$(./ar-lib ./lib rS foo.lib foo.obj)
 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
 
 # Check if ar-lib passes on @FILE with "r"
-opts=`./ar-lib ./lib r foo.lib @list`
+opts=$(./ar-lib ./lib r foo.lib @list)
 test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib @list"
 
 # Check if ar-lib can delete a member from an archive with "d".
-opts=`./ar-lib ./lib d foo.lib foo.obj`
+opts=$(./ar-lib ./lib d foo.lib foo.obj)
 test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib"
 
 # Check if ar-lib can delete members in an @FILE.
 echo foo.obj > foolist
-opts=`./ar-lib ./lib d foo.lib @foolist`
+opts=$(./ar-lib ./lib d foo.lib @foolist)
 test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib"
 
 # Check if ar-lib can list archive members with "t".
-opts=`./ar-lib ./lib t foo.lib`
+opts=$(./ar-lib ./lib t foo.lib)
 test x"$opts" = x"lib -NOLOGO -LIST foo.lib"
 
 # Check if ar-lib accepts "v" as a modifier.
 # NOTE: "v" should have an effect, but currently doesn't.
-opts=`./ar-lib ./lib tv foo.lib`
+opts=$(./ar-lib ./lib tv foo.lib)
 test x"$opts" = x"lib -NOLOGO -LIST foo.lib"
 
 # Check if ar-lib can extract archive members with "x".
 touch fake.lib
-opts=`./ar-lib ./lib x fake.lib`
+opts=$(./ar-lib ./lib x fake.lib)
 test x"$opts" = x"lib -NOLOGO -EXTRACT:fake.obj fake.lib"
 
 # Check if ar-lib can extract specified archive members with "x".
-opts=`./ar-lib ./lib x foo.lib foo.obj`
+opts=$(./ar-lib ./lib x foo.lib foo.obj)
 test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib"
 
 # Check if ar-lib can extract members in an @FILE.
-opts=`./ar-lib ./lib x foo.lib @foolist`
+opts=$(./ar-lib ./lib x foo.lib @foolist)
 test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib"
 
 # Check if ar-lib passes -lib and -LTCG through to the wrappee.
-opts=`./ar-lib ./lib -lib -LTCG x foo.lib foo.obj`
+opts=$(./ar-lib ./lib -lib -LTCG x foo.lib foo.obj)
 test x"$opts" = x"lib -lib -LTCG -NOLOGO -EXTRACT:foo.obj foo.lib"
 
 # Check if ar-lib can extract backslashed members.
 touch fake2.lib
-opts=`./ar-lib ./lib x fake2.lib`
+opts=$(./ar-lib ./lib x fake2.lib)
 test x"$opts" = x"lib -NOLOGO -EXTRACT:dir\\fake2.obj fake2.lib"
 
 # Check if ar-lib accepts "s" as an action.
-opts=`./ar-lib ./lib s foo.lib`
+opts=$(./ar-lib ./lib s foo.lib)
 test x"$opts" = x
 
 :
diff --git a/t/ar-lib5b.sh b/t/ar-lib5b.sh
index 2fb0cf4..30a44a8 100755
--- a/t/ar-lib5b.sh
+++ b/t/ar-lib5b.sh
@@ -80,7 +80,7 @@ case " $* " in
 esac
 END
 chmod +x bin/lib
-PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
 
 $ACLOCAL
 $AUTOCONF
diff --git a/t/autodist-no-duplicate.sh b/t/autodist-no-duplicate.sh
index 90a2c7d..2e610ae 100755
--- a/t/autodist-no-duplicate.sh
+++ b/t/autodist-no-duplicate.sh
@@ -27,12 +27,12 @@ re='Files .*automatically distributed.*if found'
 list1=`$AUTOMAKE --help \
         | sed -n "/^$re.*always/,/^ *$/p" \
         | sed 1d`
-list1=`echo $list1`
+list1=$(echo $list1)
 
 list2=`$AUTOMAKE --help \
         | sed -n "/^$re.*under certain conditions/,/^ *$/p" \
         | sed 1d`
-list2=`echo $list2`
+list2=$(echo $list2)
 
 test -n "$list1"
 test -n "$list2"
diff --git a/t/autodist-subdir.sh b/t/autodist-subdir.sh
index 5e1f044..19d22dc 100755
--- a/t/autodist-subdir.sh
+++ b/t/autodist-subdir.sh
@@ -40,7 +40,7 @@ list=`$AUTOMAKE --help \
         | sed -n '/^Files.*automatically distributed.*if found.*always/,/^ 
*$/p' \
         | sed 1d`
 # Normalize whitespace, just in case.
-list=`echo $list`
+list=$(echo $list)
 
 test -n "$list"
 
diff --git a/t/autodist.sh b/t/autodist.sh
index e6435c5..f8f68ad 100755
--- a/t/autodist.sh
+++ b/t/autodist.sh
@@ -39,7 +39,7 @@ list=`$AUTOMAKE --help \
         | sed -n '/^Files.*automatically distributed.*if found.*always/,/^ 
*$/p' \
         | sed 1d`
 # Normalize whitespace, just in case.
-list=`echo $list`
+list=$(echo $list)
 
 test -n "$list"
 
diff --git a/t/autohdr4.sh b/t/autohdr4.sh
index 9acbab1..9bdfd13 100755
--- a/t/autohdr4.sh
+++ b/t/autohdr4.sh
@@ -38,8 +38,7 @@ cat > Makefile.am <<'END'
 SUBDIRS = sub3
 .PHONY: test-prog-updated
 test-prog-updated:
-       stat older sub3/run$(EXEEXT) || : For debugging.
-       test `ls -t older sub3/run$(EXEEXT) | sed 1q` = sub3/run$(EXEEXT)
+       is_newest sub3/run$(EXEEXT) sub2/config.bot
 END
 
 cat > sub3/Makefile.am <<'END'
@@ -68,13 +67,12 @@ $AUTOMAKE
 ./configure --enable-dependency-tracking
 $MAKE
 # Sanity check.
-cross_compiling || { sub3/run | grep grepme1; }
+cross_compiling || sub3/run | grep grepme1 || Exit 1
 
-: > older
 $sleep
 echo '#define NAME "grepme2"' > sub2/config.bot
 $MAKE
-cross_compiling || { sub3/run | grep grepme2; }
+cross_compiling || sub3/run | grep grepme2 || Exit 1
 $MAKE test-prog-updated
 
 $MAKE distcheck
diff --git a/t/ax/depcomp.sh b/t/ax/depcomp.sh
index a9180e9..7a60229 100644
--- a/t/ax/depcomp.sh
+++ b/t/ax/depcomp.sh
@@ -69,7 +69,7 @@
 
 # This expects ./defs has already been included has already been included..
 
-ocwd=`pwd` || fatal_ "cannot get current working directory"
+ocwd=$(pwd) || fatal_ "getting current working directory"
 longpath=this-is/a-path/which-has/quite-a/definitely/truly/long_long_name
 cachevar=am_cv_CC_dependencies_compiler_type
 
@@ -343,7 +343,7 @@ do_test ()
     absolute)
       mkdir -p vpath-abs/build
       cd vpath-abs/build
-      absdir="`(cd .. && pwd)`" || fatal_ "getting absolute directory"
+      absdir=$(cd .. && pwd) || fatal_ "getting absolute directory"
       setup_srcdir "$absdir/vpath-abs"
       unset absdir
       ;;
diff --git a/t/aclocal-no-install-no-mkdir.sh b/t/ax/is_newest
similarity index 58%
copy from t/aclocal-no-install-no-mkdir.sh
copy to t/ax/is_newest
index 3e685f0..f52a1a8 100755
--- a/t/aclocal-no-install-no-mkdir.sh
+++ b/t/ax/is_newest
@@ -14,24 +14,27 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check that aclocal does not create a non-existent local m4 directory
-# if the '--install' option is not given.
+# Usage: is_newest FILE FILES
+# Fail if any file in FILES is newer than FILE, and print the list of
+# such files on the standard error.
+# Resolve ties in favor of FILE.
 
-am_create_testdir=empty
-. ./defs || Exit 1
+set -u
 
-cat > configure.ac <<END
-AC_INIT([$me], [1.0])
-MY_MACRO
-END
+me=is_newest
 
-mkdir sys-acdir
-cat > sys-acdir/my-defs.m4 <<END
-AC_DEFUN([MY_MACRO], [:])
-END
+if test $# -lt 2; then
+  echo "$me: too few arguments" >&2
+  exit 2
+fi
 
-$ACLOCAL -I foo --system-acdir=sys-acdir && Exit 1
-test ! -d foo
-test ! -r foo
+file=$1; shift
+newer_files=$(find "$@" -prune -newer "$file") || exit $?
 
-:
+if test -n "$newer_files"; then
+  echo "$me: these files are newer than '$file':" >&2
+  for f in $newer_files; do echo "* $f" >&2; done
+  exit 1
+fi
+
+exit 0
diff --git a/t/ax/tap-functions.sh b/t/ax/tap-functions.sh
index 3a5db03..eebcbe9 100644
--- a/t/ax/tap-functions.sh
+++ b/t/ax/tap-functions.sh
@@ -31,24 +31,10 @@ tap_fail_count_=0
 tap_xfail_count_=0
 tap_xpass_count_=0
 
-# The first "test -n" tries to avoid extra forks when possible.
-if test -n "${ZSH_VERSION}${BASH_VERSION}" \
-     || (eval 'test $((1 + 1)) = 2') >/dev/null 2>&1
-then
-  # Outer use of 'eval' needed to protect dumber shells from parsing
-  # errors.
-  eval 'incr_ () { eval "$1=\$((\${$1} + 1))"; }'
-else
-  incr_ () { eval "$1=\`expr \${$1} + 1\`"; }
-fi
-
 # not COMMAND [ARGS...]
 # ---------------------
 # Run the given command and invert its exit status.
-not ()
-{
-  if "$@"; then return 1; else return 0; fi
-}
+not () { ! "$@"; }
 
 # plan_ [unknown|later|lazy|now|NUMBER-OF-PLANNED-TESTS]
 # ------------------------------------------------------
@@ -136,14 +122,20 @@ result_ ()
     ""|TODO|SKIP) ;;
     *) bailout_ "result_: invalid directive '$directive_'" ;;
   esac
-  incr_ tap_count_
+  tap_count_=$(($tap_count_ + 1))
   case $tap_result_,$tap_directive_ in
-    ok,) incr_ tap_pass_count_;;                # Passed.
-    not\ ok,TODO) incr_ tap_xfail_count_;;      # Expected failure.
-    not\ ok,*) incr_ tap_fail_count_ ;;         # Failed.
-    ok,TODO) incr_ tap_xpass_count_ ;;          # Unexpected pass.
-    ok,SKIP) incr_ tap_skip_count_ ;;           # Skipped.
-    *) bailout_ "internal error in 'result_'";; # Can't happen.
+    ok,)                                                # Passed.
+      tap_pass_count_=$(($tap_pass_count_ + 1))         ;;
+    not\ ok,TODO)                                       # Expected failure.
+      tap_xfail_count_=$(($tap_xfail_count_ + 1))       ;;
+    not\ ok,*)                                          # Failed.
+      tap_fail_count_=$(($tap_fail_count_ + 1))         ;;
+    ok,TODO)                                            # Unexpected pass.
+      tap_xpass_count_=$(($tap_xpass_count_ + 1))       ;;
+    ok,SKIP)                                            # Skipped.
+      tap_skip_count_=$(($tap_skip_count_ + 1))         ;;
+    *)                                                  # Can't happen.
+      bailout_ "internal error in 'result_'"            ;;
   esac
   tap_text_="$tap_result_ $tap_count_"
   if test x"$*" != x; then
@@ -169,7 +161,7 @@ skip_ () { result_ 'ok' -D SKIP ${1+"$@"}; }
 skip_row_ ()
 {
   skip_count_=$1; shift
-  for i_ in `seq_ $skip_count_`; do skip_ ${1+"$@"}; done
+  for i_ in $(seq_ $skip_count_); do skip_ ${1+"$@"}; done
 }
 
 # skip_all_ [REASON ...]
diff --git a/t/ax/tap-summary-aux.sh b/t/ax/tap-summary-aux.sh
index fcdcf53..e74438d 100644
--- a/t/ax/tap-summary-aux.sh
+++ b/t/ax/tap-summary-aux.sh
@@ -311,7 +311,7 @@ done > tap
 
 # Lots of non-failures (300 per kind).
 (cat tap && cat tap && cat tap) > all.test
-test `wc -l <all.test` -eq 900 || Exit 99 # Sanity check.
+test $(wc -l <all.test) -eq 900 || Exit 99 # Sanity check.
 echo 1..900 >> all.test # Test plan.
 do_check --pass <<END
 $success_header
@@ -327,7 +327,7 @@ END
 
 # 1 failure and lots of non-failures means failure.
 (cat tap && echo "not ok" && cat tap) > all.test
-test `wc -l <all.test` -eq 601 || Exit 99 # Sanity check.
+test $(wc -l <all.test) -eq 601 || Exit 99 # Sanity check.
 echo 1..601 >> all.test # Test plan.
 do_check --fail <<END
 $failure_header
@@ -343,7 +343,7 @@ END
 
 # 1 error and lots of non-failures means failure.
 (cat tap && sed 30q tap && echo 'Bail out!') > all.test
-test `wc -l <all.test` -eq 331 || Exit 99 # Sanity check.
+test $(wc -l <all.test) -eq 331 || Exit 99 # Sanity check.
 echo 1..331 >> all.test # Test plan.
 do_check --fail <<END
 $failure_header
diff --git a/defs b/t/ax/test-init.sh
similarity index 90%
copy from defs
copy to t/ax/test-init.sh
index 0b01f59..9d19621 100644
--- a/defs
+++ b/t/ax/test-init.sh
@@ -19,29 +19,12 @@
 ###  IMPORTANT NOTE: keep this file 'set -e' clean.  ###
 ########################################################
 
-# NOTE: This file should execute correctly with any system's /bin/sh
-# shell, and not only with configure-time detected $AM_TEST_RUNNER_SHELL,
-# *until differently and explicitly specified*.
-
-## -------------------------------------------------------- ##
-##  Source static setup and definitions for the testsuite.  ##
-## -------------------------------------------------------- ##
-
-# Ensure we are running from the right directory.
-test -f ./defs-static || {
-   echo "$0: ./defs-static: not found in current directory" >&2
-   exit 99
-}
-
-# Source the shell sanitization and variables' definitions.
-. ./defs-static || exit 99
-
 # Enable the errexit shell flag early.
 set -e
 
 # The name of the current test (without the '.sh' or '.tap' suffix).
 # Test scripts can override it if they need to (but this should
-# be done carefully, and *before* including ./defs).
+# be done carefully).
 if test -z "$me"; then
   # Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
   me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.sh$//;s/\.tap$//'` \
@@ -49,21 +32,10 @@ if test -z "$me"; then
     || { echo "$argv0: failed to define \$me" >&2; exit 99; }
 fi
 
-## ---------------------- ##
-##  Early sanity checks.  ##
-## ---------------------- ##
-
-# A single whitespace character.
-sp=' '
-# A tabulation character.
-tab='  '
-# A newline character.
-nl='
-'
 
-# As autoconf-generated configure scripts do, ensure that IFS
-# is defined initially, so that saving and restoring $IFS works.
-IFS=$sp$tab$nl
+## --------------------- ##
+##  Early sanity checks. ##
+## --------------------- ##
 
 # Ensure $am_top_srcdir is set correctly.
 test -f "$am_top_srcdir/defs-static.in" || {
@@ -80,41 +52,21 @@ test -f "$am_top_builddir/defs-static" || {
 }
 
 
-## ------------------------------------ ##
-##  Ensure we run with a proper shell.  ##
-## ------------------------------------ ##
+## ------------------ ##
+##  Early variables.  ##
+## ------------------ ##
 
-# Make sure we run with the shell detected at configure time (unless
-# the user forbids it).
-case ${AM_TESTS_REEXEC-yes} in
-  n|no|false|0)
-    ;;
-  *)
-    # Ensure we can find ourselves.
-    if test ! -f "$0"; then
-      echo "$me: unable to find myself: $0" >&2
-      exit 99
-    fi
-    AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-    # Cannot simply do "opts=$-", since the content of $- is not
-    # portable among different shells.  So try to propagate only
-    # the portable and interesting options.
-    case $- in
-      *x*v*|*v*x) opts=-vx;;
-      *v*) opts=-v;;
-      *x*) opts=-x;;
-      *) opts=;;
-    esac
-    echo $me: exec $AM_TEST_RUNNER_SHELL $opts "$0" "$*"
-    exec $AM_TEST_RUNNER_SHELL $opts "$0" ${1+"$@"} || {
-      echo "$me: failed to re-execute with $AM_TEST_RUNNER_SHELL" >&2
-      exit 99
-    }
-    ;;
-esac
+# A single whitespace character.
+sp=' '
+# A tabulation character.
+tab='  '
+# A newline character.
+nl='
+'
 
-# NOTE: From this point on, we can assume this file is being executed
-# by the configure-time detected $AM_TEST_RUNNER_SHELL.
+# As autoconf-generated configure scripts do, ensure that IFS
+# is defined initially, so that saving and restoring $IFS works.
+IFS=$sp$tab$nl
 
 
 ## ----------------------- ##
@@ -248,16 +200,6 @@ cross_compiling ()
   test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
 }
 
-# is_newest FILE FILES
-# --------------------
-# Return false if any file in FILES is newer than FILE.
-# Resolve ties in favor of FILE.
-is_newest ()
-{
-  is_newest_files=`find "$@" -prune -newer "$1"`
-  test -z "$is_newest_files"
-}
-
 # is_blocked_signal SIGNAL-NUMBER
 # --------------------------------
 # Return success if the given signal number is blocked in the shell,
@@ -344,7 +286,7 @@ extract_configure_help ()
   am__opt_re='' am__var_re=''
   case $1 in
     --*'=')   am__opt_re="^  $1";;
-    --*'[=]') am__opt_re='^  '`printf '%s\n' "$1" | sed 's/...$//'`'\[=';;
+    --*'[=]') am__opt_re='^  '$(printf '%s\n' "$1" | sed 's/...$//')'\[=';;
     --*)      am__opt_re="^  $1( .*|$)";;
       *)      am__var_re="^  $1( .*|$)";;
   esac
@@ -507,24 +449,10 @@ seq_ ()
     3) seq_first=$1 seq_incr=$2 seq_last=$3;;
     *) fatal_ "seq_: too many arguments";;
   esac
-  # Try to avoid forks if possible.
-  case "$BASH_VERSION" in
-    ""|[12].*)
-      : Not bash, or a too old bash version. ;;
-    *)
-      # Use eval to protect dumber shells from parsing errors.
-      eval 'for ((i = seq_first; i <= seq_last; i += seq_incr)); do
-              echo $i
-            done'
-      return 0;;
-  esac
-  # Else, use GNU seq if available.
-  seq "$@" && return 0
-  # Otherwise revert to a slower loop using expr(1).
   i=$seq_first
   while test $i -le $seq_last; do
     echo $i
-    i=`expr $i + $seq_incr`
+    i=$(($i + $seq_incr))
   done
 }
 
@@ -561,12 +489,12 @@ count_test_results ()
     # Avoid spurious failures with shells with "overly sensible"
     # errexit shell flag, such as e.g., Solaris /bin/sh.
     set +e
-    test `grep -c '^PASS:'  stdout` -eq $pass  || rc=1
-    test `grep -c '^XFAIL:' stdout` -eq $xfail || rc=1
-    test `grep -c '^SKIP:'  stdout` -eq $skip  || rc=1
-    test `grep -c '^FAIL:'  stdout` -eq $fail  || rc=1
-    test `grep -c '^XPASS:' stdout` -eq $xpass || rc=1
-    test `grep -c '^ERROR:' stdout` -eq $error || rc=1
+    test $(grep -c '^PASS:'  stdout) -eq $pass  || rc=1
+    test $(grep -c '^XFAIL:' stdout) -eq $xfail || rc=1
+    test $(grep -c '^SKIP:'  stdout) -eq $skip  || rc=1
+    test $(grep -c '^FAIL:'  stdout) -eq $fail  || rc=1
+    test $(grep -c '^XPASS:' stdout) -eq $xpass || rc=1
+    test $(grep -c '^ERROR:' stdout) -eq $error || rc=1
     grep "^# TOTAL:  *$total$" stdout || rc=1
     grep "^# PASS:  *$pass$"   stdout || rc=1
     grep "^# XFAIL:  *$xfail$" stdout || rc=1
@@ -602,7 +530,8 @@ commented_sed_unindent_prog='
 unindent ()
 {
   if test x"$sed_unindent_prog" = x; then
-    sed_unindent_prog=`printf '%s\n' "$commented_sed_unindent_prog" | sed -e 
"s/  *# .*//"`
+    sed_unindent_prog=$(printf '%s\n' "$commented_sed_unindent_prog" \
+                          | sed -e "s/  *# .*//")
   fi
   sed "$sed_unindent_prog" ${1+"$@"}
 }
@@ -787,10 +716,8 @@ do
         MAKE=$make_ am__using_gmake=''
         test "$MAKE" =  : && break
         echo "$me: determine whether $MAKE is GNU make"
-        # Don't use "&&" here, or a bug of 'set -e' present in some
-        # versions of the BSD shell will be triggered.  We add the
-        # dummy "else" branch for extra safety.
-        if using_gmake; then break; else :; fi
+        using_gmake && break
+        : For shells with busted 'set -e'.
       done
       test "$MAKE" = : && skip_all_ "this test requires GNU make"
       export MAKE
@@ -855,12 +782,13 @@ do
         || skip_all_ "required program 'makedepend' not available"
       ;;
     mingw)
-      uname_s=`uname -s || echo UNKNOWN`
+      uname_s=$(uname -s || echo UNKNOWN)
       echo "$me: system name: $uname_s"
       case $uname_s in
         MINGW*) ;;
         *) skip_all_ "this test requires MSYS in MinGW mode" ;;
       esac
+      unset uname_s
       ;;
     non-root)
       # Skip this test case if the user is root.
@@ -887,9 +815,7 @@ do
       # Don't use "&&" here, to avoid a bug of 'set -e' present in
       # some (even relatively recent) versions of the BSD shell.
       # We add the dummy "else" branch for extra safety.
-      if cross_compiling; then
-        skip_all_ "doesn't work in cross-compile mode"
-      else :; fi
+      ! cross_compiling || skip_all_ "doesn't work in cross-compile mode"
       ;;
     python)
       # Python doesn't support --version, it has -V
diff --git a/t/c-demo.sh b/t/c-demo.sh
index ed2a109..c461876 100755
--- a/t/c-demo.sh
+++ b/t/c-demo.sh
@@ -169,7 +169,7 @@ if ! cross_compiling && ! grep "[ $tab]depmode=none" 
Makefile; then
   mv -f t lib/bar.h
   $MAKE
   ./src/zardoz
-  test "`./src/zardoz`" = 'Foo, Zap!'
+  test "$(./src/zardoz)" = 'Foo, Zap!'
 fi
 
 $MAKE clean
diff --git a/t/candist.sh b/t/candist.sh
index 88d8854..aaa40d4 100755
--- a/t/candist.sh
+++ b/t/candist.sh
@@ -27,6 +27,6 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-test 2 -eq `grep -c 'dist.*forbidden' stderr`
+test 2 -eq $(grep -c 'dist.*forbidden' stderr)
 
 Exit 0
diff --git a/t/ccnoco.sh b/t/ccnoco.sh
index 1df950d..60898c8 100755
--- a/t/ccnoco.sh
+++ b/t/ccnoco.sh
@@ -60,7 +60,7 @@ END
 chmod +x Mycomp
 
 # Make sure the compiler doesn't understand '-c -o'
-CC=`pwd`/Mycomp
+CC=$(pwd)/Mycomp
 export CC
 
 $ACLOCAL
diff --git a/t/ccnoco3.sh b/t/ccnoco3.sh
index eb291ec..b47ed48 100755
--- a/t/ccnoco3.sh
+++ b/t/ccnoco3.sh
@@ -58,6 +58,10 @@ END
 
 chmod +x Mycomp
 
+# Make sure the compiler doesn't understand '-c -o'
+CC=$(pwd)/Mycomp
+export CC
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --copy --add-missing
@@ -65,10 +69,6 @@ $AUTOMAKE --copy --add-missing
 mkdir build
 cd build
 
-# Make sure the compiler doesn't understand '-c -o'
-CC=`pwd`/../Mycomp
-export CC
-
 ../configure
 $MAKE 2>stderr || { cat stderr >&2; Exit 1; }
 cat stderr >&2
diff --git a/t/check12.sh b/t/check12.sh
index dbb3101..839f24f 100755
--- a/t/check12.sh
+++ b/t/check12.sh
@@ -136,12 +136,11 @@ for vpath in : false; do
   test -f hammer.sum
   test -f spanner.log
   test -f spanner.sum
-  # This checks will be run only by the autogenerated 'check12-p.test'.
   if test x"$am_serial_tests" != x"yes"; then
     test -f test-suite.log
     test -f a.log
     test -f b.log
-  else :; fi
+  fi
   grep 'check-local succeeded :-)' local.log
 
   cp -f config.status config-status.sav
@@ -168,7 +167,6 @@ for vpath in : false; do
   grep 'FAIL:' spanner.sum && Exit 1
 
   B_EXIT_STATUS=1 $MAKE check && Exit 1
-  # This checks will be run only by the autogenerated 'check12-p.test'.
   if test x"$am_serial_tests" != x"yes"; then
     cat test-suite.log
     cat a.log
@@ -179,7 +177,7 @@ for vpath in : false; do
     grep '^b\.test: exit status: 1$' test-suite.log
     grep '^a\.test' test-suite.log && Exit 1
     : For shells with busted 'set -e'.
-  else :; fi
+  fi
 
   CHECKLOCAL_EXIT_STATUS=1 $MAKE check && Exit 1
   grep 'check-local failed :-(' local.log
@@ -192,7 +190,6 @@ for vpath in : false; do
   test -f spanner.sum
   grep 'FAIL: test_hammer' hammer.sum
   grep 'FAIL:' spanner.sum && Exit 1
-  # This checks will be run only by the autogenerated 'check12-p.test'.
   if test x"$am_serial_tests" != x"yes"; then
     cat test-suite.log
     cat a.log
@@ -203,7 +200,7 @@ for vpath in : false; do
     grep '^b\.test: exit status: 23$' test-suite.log
     grep '^a\.test' test-suite.log && Exit 1
     : For shells with busted 'set -e'.
-  else :; fi
+  fi
   grep 'check-local failed :-(' local.log
 
   cd $srcdir
diff --git a/t/check3.sh b/t/check3.sh
index 69b6a67..b4858e0 100755
--- a/t/check3.sh
+++ b/t/check3.sh
@@ -56,7 +56,7 @@ END
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
-./configure --prefix "`pwd`/inst"
+./configure --prefix "$(pwd)/inst"
 
 $MAKE check >stdout || { cat stdout; Exit 1; }
 cat stdout
diff --git a/t/check4.sh b/t/check4.sh
index 78415e0..49043c7 100755
--- a/t/check4.sh
+++ b/t/check4.sh
@@ -49,7 +49,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-./configure --prefix "`pwd`/inst"
+./configure --prefix "$(pwd)/inst"
 
 $MAKE check >stdout && { cat stdout; Exit 1; }
 cat stdout
diff --git a/t/color.sh b/t/color.sh
index 6f5c902..18c6e23 100755
--- a/t/color.sh
+++ b/t/color.sh
@@ -32,7 +32,7 @@ std="$esc\[m"
 # Check that grep can parse nonprinting characters.
 # BSD 'grep' works from a pipe, but not a seekable file.
 # GNU or BSD 'grep -a' works on files, but is not portable.
-case `echo "$std" | grep .` in
+case $(echo "$std" | grep .) in
   "$std") ;;
   *) skip_ "grep can't parse nonprinting characters";;
 esac
diff --git a/t/color2.sh b/t/color2.sh
index b073d5c..041ffe6 100755
--- a/t/color2.sh
+++ b/t/color2.sh
@@ -32,7 +32,7 @@ std="$esc\[m"
 # Check that grep can parse nonprinting characters.
 # BSD 'grep' works from a pipe, but not a seekable file.
 # GNU or BSD 'grep -a' works on files, but is not portable.
-case `echo "$std" | grep .` in
+case $(echo "$std" | grep .) in
   "$std") ;;
   *) skip_ "grep can't parse nonprinting characters";;
 esac
diff --git a/t/comment4.sh b/t/comment4.sh
index 42e7bf9..efd7036 100755
--- a/t/comment4.sh
+++ b/t/comment4.sh
@@ -31,9 +31,11 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
-# UnIqUe_COPYRIGHT_BOILERPLATE should appear near the top of the file
-test `sed -n -e '1,/UnIqUe_COPYRIGHT_BOILERPLATE/p' Makefile.in \
-      | wc -l` -le 30
+# UnIqUe_COPYRIGHT_BOILERPLATE should appear near the top of the file.
+test $(sed -n -e '1,/UnIqUe_COPYRIGHT_BOILERPLATE/p' \
+                 Makefile.in | wc -l) -le 30
 # UnIqUe_MUMBLE_COMMENT should appear right before the mumble declaration.
-test `sed -n -e '/UnIqUe_MUMBLE_COMMENT/,/UnIqUe_MUMBLE_VALUE/p' Makefile.in \
-      | wc -l` -eq 2
+test $(sed -n -e '/UnIqUe_MUMBLE_COMMENT/,/UnIqUe_MUMBLE_VALUE/p' \
+                 Makefile.in | wc -l) -eq 2
+
+:
diff --git a/t/comment7.sh b/t/comment7.sh
index 5637fb7..634cc20 100755
--- a/t/comment7.sh
+++ b/t/comment7.sh
@@ -36,9 +36,11 @@ EOF
 $ACLOCAL
 $AUTOMAKE
 
+$FGREP '@COND' Makefile.in # For debugging, mostly.
+
 # The VAR definition appears once for each condition.
-test `grep '@address@hidden' Makefile.in | wc -l` = 1
-test `grep '@address@hidden' Makefile.in | wc -l` = 1
+test $(grep -c '@address@hidden' Makefile.in) = 1
+test $(grep -c '@address@hidden' Makefile.in) = 1
 
 # Make sure the right definition follows each comment.
 sed -n '/^#.*VAR.*COND_TRUE/ {
@@ -51,3 +53,5 @@ sed -n '/^#.*VAR.*COND_FALSE/ {
           p
         }' Makefile.in |
   grep '@address@hidden = bar'
+
+: 
diff --git a/t/compile3.sh b/t/compile3.sh
index 009de70..a1cc479 100755
--- a/t/compile3.sh
+++ b/t/compile3.sh
@@ -34,25 +34,29 @@ chmod +x ./cl
 # -l and -L options and their respective arguments.  Traditionally,
 # this should work also without a space.  Try both usages.
 for sp in '' ' '; do
+
   # Check if compile handles "-o foo", -I, -l, -L, -Xlinker -Wl,
-  opts=`LIB= ./compile ./cl foo.c -o foo -l${sp}bar -L${sp}gazonk -I${sp}baz 
-Xlinker foobar -Wl,-foo,bar`
-  test x"$opts" = x"foo.c -Fefoo bar.lib -Ibaz -link -LIBPATH:gazonk foobar 
-foo bar"
+  opts=$(LIB= ./compile ./cl foo.c -o foo -l${sp}bar -L${sp}gazonk \
+                             -I${sp}baz -Xlinker foobar -Wl,-foo,bar)
+  test x"$opts" = \
+       x"foo.c -Fefoo bar.lib -Ibaz -link -LIBPATH:gazonk foobar -foo bar"
 
   # Check if compile handles "-o foo.obj"
-  opts=`./compile ./cl -c foo.c -o foo.obj -I${sp}baz`
+  opts=$(./compile ./cl -c foo.c -o foo.obj -I${sp}baz)
   test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz"
 
   # Check if compile handles "-o foo.o"
-  opts=`./compile ./cl -c foo.c -o foo.o -I${sp}baz`
+  opts=$(./compile ./cl -c foo.c -o foo.o -I${sp}baz)
   test x"$opts" = x"-c foo.c -Fofoo.o -Ibaz"
 
   # Check if compile handles "foo.cc" as C++.
-  opts=`./compile ./cl -c foo.cc -o foo.o -I${sp}baz`
+  opts=$(./compile ./cl -c foo.cc -o foo.o -I${sp}baz)
   test x"$opts" = x"-c -Tpfoo.cc -Fofoo.o -Ibaz"
 
   # Check if compile clears the "eat" variable properly.
-  opts=`eat=1 ./compile ./cl -c foo.c -o foo.obj -I${sp}baz`
+  opts=$(eat=1 ./compile ./cl -c foo.c -o foo.obj -I${sp}baz)
   test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz"
+
 done
 
 :
diff --git a/t/compile4.sh b/t/compile4.sh
index bb9f671..8e516e3 100755
--- a/t/compile4.sh
+++ b/t/compile4.sh
@@ -25,25 +25,24 @@ get_shell_script compile
 mkdir sub
 
 cat >sub/foo.c <<'EOF'
-int
-foo ()
+int foo (void)
 {
   return 0;
 }
 EOF
 
 cat >main.c <<'EOF'
-extern int foo ();
-int
-main ()
+extern int foo (void);
+int main (void)
 {
   return foo ();
 }
 EOF
 
-absfoodir=`pwd`/sub
-absmainc=`pwd`/main.c
-absmainobj=`pwd`/main.obj
+cwd=$(pwd) || fatal_ "cannot get current directory"
+absfoodir=$cwd/sub
+absmainc=$cwd/main.c
+absmainobj=$cwd/main.obj
 
 cat >> configure.ac << 'END'
 AC_PROG_CC
@@ -84,9 +83,8 @@ fi
 # this should work also without a space.  Try both usages.
 for sp in '' ' '; do
   rm -f main
-
-  ./compile cl $CFLAGS $LDFLAGS -L${sp}"$absfoodir" "$absmainobj" -o main 
-l${sp}foo
-
+  ./compile cl $CFLAGS $LDFLAGS -L${sp}"$absfoodir" "$absmainobj" \
+               -o main -l${sp}foo
   ./main
 done
 
diff --git a/t/compile5.sh b/t/compile5.sh
index 02afca3..0f787cc 100755
--- a/t/compile5.sh
+++ b/t/compile5.sh
@@ -62,7 +62,7 @@ $AUTOMAKE -a
 ./configure
 . ./check_host
 
-pwd=`pwd`
+cwd=$(pwd) || fatal_ "cannot get current directory"
 
 # POSIX mandates that the compiler accepts a space between the -I,
 # -l and -L options and their respective arguments.  Traditionally,
@@ -70,15 +70,10 @@ pwd=`pwd`
 for sp in '' ' '; do
   # Check if "compile cl" transforms absolute file names to
   # host format (e.g /somewhere -> c:/msys/1.0/somewhere).
-
-  res=`./compile ./cl -L${sp}"$pwd" | sed -e 's/-link -LIBPATH://'`
-
+  res=$(./compile ./cl -L${sp}"$cwd" | sed -e 's/-link -LIBPATH://')
   case $res in
-    ?:[\\/]*)
-      ;;
-    *)
-      Exit 1
-      ;;
+    ?:[\\/]*) ;;
+    *) Exit 1 ;;
   esac
 done
 
diff --git a/t/compile6.sh b/t/compile6.sh
index 9db3373..3979802 100755
--- a/t/compile6.sh
+++ b/t/compile6.sh
@@ -34,72 +34,74 @@ chmod +x ./cl
 # -l and -L options and their respective arguments.  Traditionally,
 # this should work also without a space.  Try both usages.
 for sp in '' ' '; do
+
   rm -rf lib lib2 syslib "sys  lib2"
 
   mkdir syslib
-  :> syslib/foo.lib
+  : > syslib/foo.lib
 
-  syslib=`pwd`/syslib
+  syslib=$(pwd)/syslib
   LIB=$syslib
   export LIB
 
   mkdir lib
-  :> lib/bar.lib
-  :> lib/bar.dll.lib
+  : > lib/bar.lib
+  : > lib/bar.dll.lib
 
   # Check if compile library search correctly
-  opts=`./compile ./cl foo.c -o foo -L${sp}lib -l${sp}bar -l${sp}foo`
+  opts=$(./compile ./cl foo.c -o foo -L${sp}lib -l${sp}bar -l${sp}foo)
   test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib"
 
   # Check if -static makes compile avoid bar.dll.lib
-  opts=`./compile ./cl foo.c -o foo -L${sp}lib -static -l${sp}bar -l${sp}foo`
+  opts=$(./compile ./cl foo.c -o foo -L${sp}lib -static -l${sp}bar -l${sp}foo)
   test x"$opts" = x"foo.c -Fefoo lib/bar.lib $syslib/foo.lib -link 
-LIBPATH:lib"
 
-  :> syslib/bar.lib
-  :> syslib/bar.dll.lib
+  : > syslib/bar.lib
+  : > syslib/bar.dll.lib
 
   # Check if compile finds bar.dll.lib in syslib
-  opts=`./compile ./cl foo.c -o foo -l${sp}bar -l${sp}foo`
+  opts=$(./compile ./cl foo.c -o foo -l${sp}bar -l${sp}foo)
   test x"$opts" = x"foo.c -Fefoo $syslib/bar.dll.lib $syslib/foo.lib"
 
   # Check if compile prefers -L over $LIB
-  opts=`./compile ./cl foo.c -o foo -L${sp}lib -l${sp}bar -l${sp}foo`
+  opts=$(./compile ./cl foo.c -o foo -L${sp}lib -l${sp}bar -l${sp}foo)
   test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib"
 
   mkdir lib2
-  :> lib2/bar.dll.lib
+  : > lib2/bar.dll.lib
 
   # Check if compile avoids bar.dll.lib in lib2 when -static
-  opts=`./compile ./cl foo.c -o foo -L${sp}lib2 -static -l${sp}bar -l${sp}foo`
+  opts=$(./compile ./cl foo.c -o foo -L${sp}lib2 -static -l${sp}bar -l${sp}foo)
   test x"$opts" = x"foo.c -Fefoo $syslib/bar.lib $syslib/foo.lib -link 
-LIBPATH:lib2"
 
   # Check if compile gets two different bar libraries when -static
   # is added in the middle
-  opts=`./compile ./cl foo.c -o foo -L${sp}lib2 -L${sp}lib -l${sp}bar -static 
-l${sp}bar`
+  opts=$(./compile ./cl foo.c -o foo -L${sp}lib2 -L${sp}lib -l${sp}bar -static 
-l${sp}bar)
   test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib lib/bar.lib -link 
-LIBPATH:lib2 -LIBPATH:lib"
 
   # Check if compile gets the correct bar.dll.lib
-  opts=`./compile ./cl foo.c -o foo -L${sp}lib -L${sp}lib2 -l${sp}bar 
-l${sp}foo`
+  opts=$(./compile ./cl foo.c -o foo -L${sp}lib -L${sp}lib2 -l${sp}bar 
-l${sp}foo)
   test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib -LIBPATH:lib2"
 
   # Check if compile gets the correct bar.dll.lib
-  opts=`./compile ./cl foo.c -o foo -L${sp}lib2 -L${sp}lib -l${sp}bar 
-l${sp}foo`
+  opts=$(./compile ./cl foo.c -o foo -L${sp}lib2 -L${sp}lib -l${sp}bar 
-l${sp}foo)
   test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib2 -LIBPATH:lib"
 
   mkdir "sys  lib2"
-  :> "sys  lib2/foo.dll.lib"
+  : > "sys  lib2/foo.dll.lib"
 
-  syslib2="`pwd`/sys  lib2"
+  syslib2="$(pwd)/sys  lib2"
   LIB="$syslib2;$LIB"
 
   # Check if compile handles spaces in $LIB and that it prefers the order
   # in a multi-component $LIB.
-  opts=`./compile ./cl foo.c -o foo -l${sp}foo`
+  opts=$(./compile ./cl foo.c -o foo -l${sp}foo)
   test x"$opts" = x"foo.c -Fefoo $syslib2/foo.dll.lib"
 
   # Check if compile handles the 2nd directory in a multi-component $LIB.
-  opts=`./compile ./cl foo.c -o foo -static -l${sp}foo`
+  opts=$(./compile ./cl foo.c -o foo -static -l${sp}foo)
   test x"$opts" = x"foo.c -Fefoo $syslib/foo.lib"
+
 done
 
 :
diff --git a/t/cond14.sh b/t/cond14.sh
index f3725c3..7f300e8 100755
--- a/t/cond14.sh
+++ b/t/cond14.sh
@@ -46,6 +46,6 @@ $ACLOCAL
 $AUTOMAKE
 
 $FGREP helldl Makefile.in # For debugging.
-test `$FGREP -c 'helldl$(EXEEXT):' Makefile.in` -eq 2
+test $($FGREP -c 'helldl$(EXEEXT):' Makefile.in) -eq 2
 
 :
diff --git a/t/cond15.sh b/t/cond15.sh
index 68f70fd..8ee799b 100755
--- a/t/cond15.sh
+++ b/t/cond15.sh
@@ -53,8 +53,8 @@ $ACLOCAL
 $AUTOMAKE
 
 $FGREP helldl Makefile.in # For debugging.
-num1=`$FGREP 'helldl$(EXEEXT):' Makefile.in | wc -l`
-num2=`$FGREP '@COND1_FALSE@@address@hidden(EXEEXT):' Makefile.in | wc -l`
+num1=$($FGREP -c 'helldl$(EXEEXT):' Makefile.in)
+num2=$($FGREP -c '@COND1_FALSE@@address@hidden(EXEEXT):' Makefile.in)
 test $num1 -eq 4
 test $num2 -eq 1
 
diff --git a/t/cond33.sh b/t/cond33.sh
index 9655d3b..d8b6087 100755
--- a/t/cond33.sh
+++ b/t/cond33.sh
@@ -47,7 +47,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-cwd=`pwd` || fatal_ "cannot get current directory"
+cwd=$(pwd) || fatal_ "cannot get current directory"
 mkdir nowhere
 chmod a-w nowhere
 
diff --git a/t/cond35.sh b/t/cond35.sh
index 043b3b0..a870902 100755
--- a/t/cond35.sh
+++ b/t/cond35.sh
@@ -55,7 +55,7 @@ $AUTOCONF
 $AUTOMAKE --add-missing
 
 $FGREP 'tparse.h' Makefile.in # For debugging.
-test `$FGREP -c 'tparse.h:' Makefile.in` = 1
+test $($FGREP -c 'tparse.h:' Makefile.in) -eq 1
 
 cat > tscan.l << 'END'
 %{
diff --git a/t/cond36.sh b/t/cond36.sh
index 82200cc..d9b0699 100755
--- a/t/cond36.sh
+++ b/t/cond36.sh
@@ -54,7 +54,7 @@ $AUTOMAKE -Wno-error
 
 # Still and all, it should generate two rules.
 $FGREP 'tparse.h' Makefile.in # For debugging.
-test `$FGREP -c 'tparse.h:' Makefile.in` = 2
+test $($FGREP -c 'tparse.h:' Makefile.in) -eq 2
 $FGREP '@address@hidden:' Makefile.in
 $FGREP '@address@hidden:' Makefile.in
 
diff --git a/t/cond42.sh b/t/cond42.sh
index d4eee01..c217726 100755
--- a/t/cond42.sh
+++ b/t/cond42.sh
@@ -54,6 +54,6 @@ _AM_COND_ENDIF/'
 AUTOMAKE_fails
 grep '^configure\.ac:7:.* not enough arguments.* _AM_COND_IF' stderr
 grep '^configure\.ac:8:.* not enough arguments.* _AM_COND_ENDIF' stderr
-test 2 = `grep -c 'not enough arguments' stderr`
+test 2 -eq $($FGREP -c 'not enough arguments' stderr)
 
 :
diff --git a/t/cond5.sh b/t/cond5.sh
index 3961303..8accd67 100755
--- a/t/cond5.sh
+++ b/t/cond5.sh
@@ -45,8 +45,8 @@ $ACLOCAL
 $AUTOMAKE 2>stderr &
 pid=$!
 
-# MSYS bash seems to have a bug in kill, so don't try to kill too soon;
-# and avoid maintainer-check test.
+# MSYS bash seems to have a bug in kill, so don't try to kill too soon.
+# The extra quoting avoids a maintainer-check failure.
 sleep '2'
 
 # Make at most 30 tries, one every 10 seconds (= 300 seconds = 5 min).
@@ -55,7 +55,7 @@ while test $try -le 30; do
   if kill -0 $pid; then
     : process $pid is still alive, wait and retry
     sleep '10'
-    try=`expr $try + 1`
+    try=$(($try + 1))
   else
     cat stderr >&2
     # Automake must fail with a proper error message.
diff --git a/t/cond6.sh b/t/cond6.sh
index f6a499d..42fa407 100755
--- a/t/cond6.sh
+++ b/t/cond6.sh
@@ -57,7 +57,7 @@ touch aclocal.m4 # Avoid unnecessary firing the remake rules.
 $AUTOCONF
 $AUTOMAKE Makefile
 
-./configure --prefix="`pwd`/_inst"
+./configure --prefix="$(pwd)/_inst"
 
 $MAKE test
 
diff --git a/t/cond8.sh b/t/cond8.sh
index f21aacb..c498b75 100755
--- a/t/cond8.sh
+++ b/t/cond8.sh
@@ -58,7 +58,7 @@ END
 
 cp x.c y.c
 
-instdir=`pwd`/_inst || fatal_ "cannot get current directory"
+instdir=$(pwd)/_inst || fatal_ "cannot get current directory"
 
 # Skip the rest of the test in case of e.g. missing C compiler.
 ./configure --prefix="$instdir" x=yes || Exit $?
diff --git a/t/condhook.sh b/t/condhook.sh
index 3b0f89c..bcd0551 100755
--- a/t/condhook.sh
+++ b/t/condhook.sh
@@ -39,7 +39,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-./configure --prefix "`pwd`/inst"
+./configure --prefix "$(pwd)/inst"
 
 $MAKE install
 test -f inst/etc/mumble
diff --git a/t/condhook2.sh b/t/condhook2.sh
index a853e37..f68332c 100755
--- a/t/condhook2.sh
+++ b/t/condhook2.sh
@@ -38,7 +38,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-./configure --prefix "`pwd`/inst"
+./configure --prefix "$(pwd)/inst"
 
 $MAKE install
 test -f inst/etc/mumble
diff --git a/t/condman3.sh b/t/condman3.sh
index 9f2714f..89196df 100755
--- a/t/condman3.sh
+++ b/t/condman3.sh
@@ -58,14 +58,14 @@ $EGREP 'MANS|\.([123456789]|man)' Makefile.in # For 
debugging.
 
 mkdir build
 cd build
-../configure FOO=true --prefix="`pwd`/_inst"
+../configure FOO=true --prefix="$(pwd)/_inst"
 $EGREP 'MANS|\.([123456789]|man)' Makefile # For debugging.
 touch foo.1 6.man
 $MAKE install
 $MAKE test1
 
 cd ..
-./configure FOO=false --prefix="`pwd`/_inst"
+./configure FOO=false --prefix="$(pwd)/_inst"
 $EGREP 'MANS|\.([123456789]|man)' Makefile # For debugging.
 touch bar.2 baz.1 zap.5
 $MAKE install
diff --git a/t/copy.sh b/t/copy.sh
index a9f0f56..9ae7292 100755
--- a/t/copy.sh
+++ b/t/copy.sh
@@ -77,7 +77,7 @@ test -f auxdir/install-sh
 is_symlink auxdir/install-sh
 test -f auxdir/depcomp
 is_not_symlink auxdir/depcomp
-test FAKE-DEPCOMP = `cat auxdir/depcomp`
+test FAKE-DEPCOMP = "$(cat auxdir/depcomp)"
 
 # 'automake -a -c' should not create symlinks, even when there are
 # already symlinked required auxiliary files.
diff --git a/t/cscope.tap b/t/cscope.tap
index dbc4993..f1f0c4e 100755
--- a/t/cscope.tap
+++ b/t/cscope.tap
@@ -20,7 +20,7 @@
 
 plan_ 18
 
-ocwd=`pwd` || fatal_ "getting top-level directory"
+ocwd=$(pwd) || fatal_ "getting top-level directory"
 
 cat >> configure.ac << 'END'
 AC_CONFIG_FILES([sub/Makefile])
diff --git a/t/dejagnu-siteexp-useredit.sh b/t/dejagnu-siteexp-useredit.sh
index 9be5eba..63fc18b 100755
--- a/t/dejagnu-siteexp-useredit.sh
+++ b/t/dejagnu-siteexp-useredit.sh
@@ -56,7 +56,7 @@ $MAKE site.exp
 cat site.exp
 is_newest site.exp Makefile  # Sanity check.
 grep '|objdir|' site.exp
-test `grep -c '|objdir|' site.exp` -eq 1
+test $($FGREP -c '|objdir|' site.exp) -eq 1
 
 # We can do a "more semantic" check if DejaGnu is available.
 if runtest SOMEPROGRAM=someprogram --version; then
diff --git a/t/dejagnu2.sh b/t/dejagnu2.sh
index 0a0d091..8feb5de 100755
--- a/t/dejagnu2.sh
+++ b/t/dejagnu2.sh
@@ -34,7 +34,7 @@ $AUTOCONF
 $AUTOMAKE -Wno-override
 
 grep 'site\.exp' Makefile.in
-test `grep -c '^site\.exp:' Makefile.in` -eq 1
+test $(grep -c '^site\.exp:' Makefile.in) -eq 1
 
 ./configure
 $MAKE site.exp
diff --git a/t/dejagnu4.sh b/t/dejagnu4.sh
index 44904df..1c94798 100755
--- a/t/dejagnu4.sh
+++ b/t/dejagnu4.sh
@@ -17,11 +17,11 @@
 # Check that the DejaGnu rules work for a simple program and test case.
 # Also check PR 488: Failure of the first of several tools tested.
 # From the original bug report:
-# ``If you use dejagnu for testing and have multiple tools (i.e.,
+#   If you use dejagnu for testing and have multiple tools (i.e.,
 #   multiple entries in the DEJATOOL variable) then the success/failure
 #   of "make check" is only dependent on the success/failure of the
 #   tests on the final tool. Thus there may be failures in the tests on
-#   previous tools, but at first glance "make check" has passed.''
+#   previous tools, but at first glance "make check" has passed.
 
 required=runtest
 . ./defs || Exit 1
diff --git a/t/depend.sh b/t/depend.sh
index a2e3bd8..b69427d 100755
--- a/t/depend.sh
+++ b/t/depend.sh
@@ -31,4 +31,6 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-test 1 = `grep 'address@hidden@@am__include@' Makefile.in | wc -l`
+test 1 -eq $(grep -c 'address@hidden@@am__include@' Makefile.in)
+
+:
diff --git a/t/depend4.sh b/t/depend4.sh
index d9896f8..e3ace0b 100755
--- a/t/depend4.sh
+++ b/t/depend4.sh
@@ -30,7 +30,7 @@ for header in one.h two.h three.h four.h five.h six.h; do
     fred_SOURCES = fred1.c $headers
 END
   $AUTOMAKE
-  test 1 = `grep 'address@hidden@@am__include@' Makefile.in | wc -l`
+  test 1 -eq $(grep -c 'address@hidden@@am__include@' Makefile.in)
 done
 
 :
diff --git a/t/dirlist-abspath.sh b/t/dirlist-abspath.sh
index 78af8b1..f33f445 100755
--- a/t/dirlist-abspath.sh
+++ b/t/dirlist-abspath.sh
@@ -20,7 +20,7 @@ am_create_testdir=empty
 . ./defs || Exit 1
 
 mkdir acdir-more sub sub/acdir
-echo "`pwd`/acdir-more" > sub/acdir/dirlist
+echo "$(pwd)/acdir-more" > sub/acdir/dirlist
 
 echo 'AC_DEFUN([AM_FOO], [foo-foo--foo])' > acdir-more/foo.m4
 
diff --git a/t/dist-auxdir-many-subdirs.sh b/t/dist-auxdir-many-subdirs.sh
index 39eb373..caa4e86 100755
--- a/t/dist-auxdir-many-subdirs.sh
+++ b/t/dist-auxdir-many-subdirs.sh
@@ -22,7 +22,7 @@ required=cc
 . ./defs || Exit 1
 
 count=0
-ocwd=`pwd` || fatal_ "cannot get current working directory"
+ocwd=$(pwd) || fatal_ "cannot get current working directory"
 
 # Usage: do_check [--add-missing] [CONFIG-AUXDIR-PATH=.]
 do_check ()
@@ -33,7 +33,7 @@ do_check ()
   esac
   auxdir=${1-.}
 
-  count=`expr $count + 1`
+  count=$(($count + 1))
   mkdir T$count.d
   cd T$count.d
 
diff --git a/t/dist-auxfile.sh b/t/dist-auxfile.sh
index 9f7e8ee..500f6b8 100755
--- a/t/dist-auxfile.sh
+++ b/t/dist-auxfile.sh
@@ -27,7 +27,7 @@ for auxdir in build-aux ''; do
 
   echo "*** Testing with auxdir '$auxdir' ***"
 
-  i=`expr $i + 1`
+  i=$(($i + 1))
   mkdir T$i.d
   cd T$i.d
 
diff --git a/t/dist-formats.tap b/t/dist-formats.tap
index 26c6c97..ac6853b 100755
--- a/t/dist-formats.tap
+++ b/t/dist-formats.tap
@@ -26,7 +26,7 @@ plan_ 70
 #  Common and/or auxiliary subroutines and variables.  #
 # ---------------------------------------------------- #
 
-ocwd=`pwd` || fatal_ "obtaining current working directory"
+ocwd=$(pwd) || fatal_ "getting current working directory"
 
 TAR='' && unset TAR
 
@@ -66,45 +66,56 @@ setup_vars_for_compression_format ()
   esac
 }
 
+have_compressor ()
+{
+  test $# -eq 1 || fatal_ "have_compressor(): bad usage"
+  case $1 in
+    # Assume gzip(1) is available on every reasonable portability target.
+    gzip)
+      return 0;;
+    # On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils
+    # and is just a dummy script that is not able to actually compress
+    # (it can only decompress).  So, check that the 'compress' program
+    # is actually able to compress input.
+    # Note that, at least on GNU/Linux, 'compress' does (and is
+    # documented to) exit with status 2 if the output is larger than
+    # the input after (attempted) compression; so we need to pass it
+    # an input that it can actually reduce in size when compressing.
+    compress)
+      for x in 1 2 3 4 5 6 7 8; do
+        echo aaaaaaaaaaaaaaaaaaaaa
+      done | compress -c >/dev/null && return 0
+      return 1
+      ;;
+    *)
+      # Redirect to stderr to avoid polluting the output, in case this
+      # function is used in a command substitution (as it is, below).
+      if $1 --version </dev/null >&2; then
+        return 0
+      else
+        return 1
+      fi
+      ;;
+  esac
+  fatal_ "have_compressor(): dead code reached"
+}
+
 all_compression_formats='gzip tarZ lzip xz bzip2 zip shar'
 
-all_compressors=`
+all_compressors=$(
   for x in $all_compression_formats; do
     setup_vars_for_compression_format $x
     echo $compressor
-  done | tr "$nl" ' '`
+  done | tr "$nl" ' ')
 echo All compressors: $all_compressors
 
-missing_compressors=`
+missing_compressors=$(
   for c in $all_compressors; do
-    case $c in
-      # Assume gzip(1) is available on every reasonable portability target.
-      gzip)
-        continue
-        ;;
-      # On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils
-      # and is just a dummy script that is not able to actually compress
-      # (it can only decompress).  So, check that the 'compress' program
-      # is actually able to compress input.
-      # Note that, at least on GNU/Linux, 'compress' does (and is
-      # documented to) exit with status 2 if the output is larger than
-      # the input after (attempted) compression; so we need to pass it
-      # an input that it can actually reduce in size when compressing.
-      compress)
-        for x in 1 2 3 4 5 6 7 8; do
-          echo aaaaaaaaaaaaaaa
-        done | $c -c >/dev/null && continue
-        : For shells with busted 'set -e'.
-        ;;
-      *)
-        $c --version </dev/null >&2 && continue
-        : For shells with busted 'set -e'.
-        ;;
-    esac
-    echo $c
-  done | tr "$nl" ' '`
+    have_compressor $c || echo $c
+  done | tr "$nl" ' ')
 echo Missing compressors: $missing_compressors
 
+# Redefine to avoid re-running the already executed checks.
 have_compressor ()
 {
   case " $missing_compressors " in *\ $1\ *) false;; *) : ;; esac
@@ -122,8 +133,8 @@ start_subtest ()
   if test $# -gt 0; then
     eval "$@" || fatal_ "start_subtest: evaluating assignments"
   fi
-  ac_opts=`echo $ac_opts | tr ',' ' '`
-  am_opts=`echo $am_opts | tr ',' ' '`
+  ac_opts=$(echo $ac_opts | tr ',' ' ')
+  am_opts=$(echo $am_opts | tr ',' ' ')
   mkdir "$name"
   cd "$name"
   unindent > configure.ac <<END
@@ -171,7 +182,7 @@ can_compress ()
         && $MAKE dist-$format \
         && test -f $tarname-1.0.$suffix \
         && ls -l *$tarname* \
-        && test "`ls *$tarname*`" = $tarname-1.0.$suffix'
+        && test "$(echo *$tarname*)" = $tarname-1.0.$suffix'
 
   unset suffix compressor format tarname
 }
@@ -188,7 +199,7 @@ command_ok_ "default [configure]"       ./configure
 command_ok_ "default [make distcheck]"  $MAKE distcheck
 
 command_ok_ "'make dist' only builds *.tar.gz by default" \
-            test "`ls *defaults*`" = defaults-1.0.tar.gz
+            test "$(ls *defaults*)" = defaults-1.0.tar.gz
 
 rm -rf *defaults*
 
@@ -430,7 +441,7 @@ ls -l # For debugging.
 cd ..
 
 oPATH=$PATH
-PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
 
 command_ok_ \
   "$desc ['make dist-all', stubbed]" \
diff --git a/t/dist-included-parent-dir.sh b/t/dist-included-parent-dir.sh
index ae135ae..a74c6db 100755
--- a/t/dist-included-parent-dir.sh
+++ b/t/dist-included-parent-dir.sh
@@ -45,5 +45,7 @@ $AUTOCONF
 $AUTOMAKE
 # Use --srcdir with an absolute path because it's harder
 # to support in 'distdir'.
-./configure --srcdir "`pwd`"
+./configure --srcdir "$(pwd)"
 $MAKE test
+
+:
diff --git a/t/dist-missing-am.sh b/t/dist-missing-am.sh
index 0765b0c..3390884 100755
--- a/t/dist-missing-am.sh
+++ b/t/dist-missing-am.sh
@@ -39,7 +39,7 @@ $AUTOMAKE
 
 # A faulty distribution tarball, with a required '.am' file missing.
 # Building from it should fail, both for in-tree and VPATH builds.
-ocwd=`pwd` || fatal_ "cannot get current working directory"
+ocwd=$(pwd) || fatal_ "cannot get current working directory"
 for vpath in false :; do
   $MAKE distdir
   test -f $distdir/zardoz.am # Sanity check.
diff --git a/t/dist-missing-included-m4.sh b/t/dist-missing-included-m4.sh
index 5960003..b2835ee 100755
--- a/t/dist-missing-included-m4.sh
+++ b/t/dist-missing-included-m4.sh
@@ -41,7 +41,7 @@ $AUTOMAKE
 
 # A faulty distribution tarball, with a required '.m4' file missing.
 # Building from it should fail, both for in-tree and VPATH builds.
-ocwd=`pwd` || fatal_ "cannot get current working directory"
+ocwd=$(pwd) || fatal_ "cannot get current working directory"
 for vpath in false :; do
   $MAKE distdir
   test -f $distdir/zardoz.m4 # Sanity check.
diff --git a/t/dist-missing-m4.sh b/t/dist-missing-m4.sh
index 9a418d3..b8284cb 100755
--- a/t/dist-missing-m4.sh
+++ b/t/dist-missing-m4.sh
@@ -43,7 +43,7 @@ $AUTOMAKE
 
 # A faulty distribution tarball, with a required '.m4' file missing.
 # Building from it should fail, both for in-tree and VPATH builds.
-ocwd=`pwd` || fatal_ "cannot get current working directory"
+ocwd=$(pwd) || fatal_ "cannot get current working directory"
 for vpath in false :; do
   $MAKE distdir
   test -f $distdir/m4/zardoz.m4 # Sanity check.
diff --git a/t/dist-repeated.sh b/t/dist-repeated.sh
index 6651e72..f67d17e 100755
--- a/t/dist-repeated.sh
+++ b/t/dist-repeated.sh
@@ -45,7 +45,7 @@ pythondir = ${prefix}/py
 PYTHON = false
 END
 
-ocwd=`pwd` || fatal_ "cannot get current working directory"
+ocwd=$(pwd) || fatal_ "cannot get current working directory"
 
 # Help to ensure cp won't see the same file twice.
 mkdir bin
@@ -80,7 +80,7 @@ esac
 exec cp "\$@"
 END
 chmod a+x bin/cp
-PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH;
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH;
 
 : > foo.c
 : > bar.py
diff --git a/t/distcheck-missing-m4.sh b/t/distcheck-missing-m4.sh
index e583be1..051e52d 100755
--- a/t/distcheck-missing-m4.sh
+++ b/t/distcheck-missing-m4.sh
@@ -20,7 +20,7 @@
 
 . ./defs || Exit 1
 
-cwd=`pwd` || fatal_ "cannot get current working directory"
+cwd=$(pwd) || fatal_ "cannot get current working directory"
 
 cp "$am_testauxdir"/distcheck-hook-m4.am . \
   || fatal_ "cannot fetch makefile fragment 'distcheck-hook-m4.am'"
diff --git a/t/distcheck-outdated-m4.sh b/t/distcheck-outdated-m4.sh
index 71ae3dd..ac8ce54 100755
--- a/t/distcheck-outdated-m4.sh
+++ b/t/distcheck-outdated-m4.sh
@@ -20,7 +20,7 @@
 
 . ./defs || Exit 1
 
-cwd=`pwd` || fatal_ "cannot get current working directory"
+cwd=$(pwd) || fatal_ "cannot get current working directory"
 
 cp "$am_testauxdir"/distcheck-hook-m4.am . \
   || fatal_ "cannot fetch makefile fragment 'distcheck-hook-m4.am'"
diff --git a/t/distcheck-override-infodir.sh b/t/distcheck-override-infodir.sh
index 746b5f8..4aaf268 100755
--- a/t/distcheck-override-infodir.sh
+++ b/t/distcheck-override-infodir.sh
@@ -55,7 +55,7 @@ $AUTOCONF
 $MAKE
 
 $MAKE distcheck
-infodir="`pwd`"/_info $MAKE -e distcheck
+infodir="$(pwd)/_info" $MAKE -e distcheck
 test -f _info/dir || Exit 99 # Sanity check.
 
 :
diff --git a/t/distcheck-pr9579.sh b/t/distcheck-pr9579.sh
index 8c78900..0b205e8 100755
--- a/t/distcheck-pr9579.sh
+++ b/t/distcheck-pr9579.sh
@@ -42,7 +42,7 @@ $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
 
-./configure --prefix="`pwd`/inst"
+./configure --prefix="$(pwd)/inst"
 
 # Sanity checks.
 $MAKE install
diff --git a/t/distcom4.sh b/t/distcom4.sh
index 6f9d871..b785fec 100755
--- a/t/distcom4.sh
+++ b/t/distcom4.sh
@@ -68,7 +68,7 @@ sed -n -e '/^DIST_COMMON =.*\\$/ {
 
 cat dc.txt # For debugging.
 
-test 1 = `grep tests dc.txt | wc -l`
+test 1 -eq $(grep -c tests dc.txt)
 grep configure dc.txt
 
 :
diff --git a/t/distcom5.sh b/t/distcom5.sh
index adfbe52..de6ea11 100755
--- a/t/distcom5.sh
+++ b/t/distcom5.sh
@@ -78,7 +78,7 @@ extract_distcommon tests/Makefile.in > inner.txt
 cat top.txt
 cat inner.txt
 
-test 0 = `grep tests top.txt | wc -l`
-test 1 = `grep wrapper inner.txt | wc -l`
+test 0 -eq $(grep -c tests top.txt)
+test 1 -eq $(grep -c wrapper inner.txt)
 
 :
diff --git a/t/distdir.sh b/t/distdir.sh
index 0657928..41a9a8c 100755
--- a/t/distdir.sh
+++ b/t/distdir.sh
@@ -76,7 +76,7 @@ cat stdout
 grep 'MKDIR_P.*\.' stdout && Exit 1
 
 cd ..
-./configure --prefix "`pwd`"
+./configure --prefix "$(pwd)"
 $MAKE distcheck
 
 :
diff --git a/t/disthook.sh b/t/disthook.sh
index 9804e99..98f086d 100755
--- a/t/disthook.sh
+++ b/t/disthook.sh
@@ -71,7 +71,7 @@ chmod a-x execute
 $MAKE distdir
 ls -l $distdir $distdir/doc
 cd $distdir
-test "`cat write`" = "all is ok"
+test "$(cat write)" = "all is ok"
 test ! -f removed
 test ! -r removed
 test -f doc/README
@@ -82,7 +82,6 @@ test ! -r doc/HACING
 ./execute | grep 'I run successfully'
 cd ..
 
-
 $MAKE distcheck
 test -f distcheck-run
 
diff --git a/t/distlinks.sh b/t/distlinks.sh
index 08244c0..97b5b49 100755
--- a/t/distlinks.sh
+++ b/t/distlinks.sh
@@ -36,7 +36,7 @@ ln -s foo  bar1
 ln -s bar1 bar2
 ln -s bar2 bar3
 
-ln -s "`pwd`/foo" quux
+ln -s "$(pwd)/foo" quux
 
 cat >> configure.ac << 'END'
 AC_OUTPUT
diff --git a/t/distlinksbrk.sh b/t/distlinksbrk.sh
index b7732ca..cf0556e 100755
--- a/t/distlinksbrk.sh
+++ b/t/distlinksbrk.sh
@@ -29,7 +29,7 @@ lnkb=${lnk_base}__bbb
 
 ln -s nonesuch $lnk1 || skip_ "cannot create broken symlinks"
 
-ln -s "`pwd`/nonesuch" $lnk2
+ln -s "$(pwd)/nonesuch" $lnk2
 
 ln -s $lnk1 $lnka
 ln -s $lnka $lnkb
diff --git a/t/dollar.sh b/t/dollar.sh
index 92ed26a..2fc9c93 100755
--- a/t/dollar.sh
+++ b/t/dollar.sh
@@ -38,7 +38,9 @@ EOF
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
-./configure --prefix "`pwd`/inst"
+./configure --prefix "$(pwd)/inst"
 $MAKE install
 test -f 'inst/my/hello$world'
 $MAKE check-dist
+
+:
diff --git a/t/empty.sh b/t/empty.sh
index 795f922..23f8a7d 100755
--- a/t/empty.sh
+++ b/t/empty.sh
@@ -25,5 +25,7 @@ echo 'data_DATA =' >Makefile.am
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
-./configure --prefix "`pwd`/inst"
+./configure --prefix "$(pwd)/inst"
 $MAKE install
+
+:
diff --git a/t/exeext.sh b/t/exeext.sh
index 42fa574..a07bdcb 100755
--- a/t/exeext.sh
+++ b/t/exeext.sh
@@ -62,7 +62,7 @@ grep '^maude\.static$(EXEEXT):' Makefile.in
 grep '^maude3$(EXEEXT):' Makefile.in
 grep '^mt$(EXEEXT):' Makefile.in
 grep '^rmt$(EXEEXT):' Makefile.in
-test `grep '^bin_PROGRAMS =' Makefile.in | wc -l` = 1
+test $(grep -c '^bin_PROGRAMS =' Makefile.in) -eq 1
 
 # Make sure $(EXEEXT) gets stripped before canonicalization.
 grep 'maude3__EXEEXT__OBJECTS' Makefile.in && Exit 1
@@ -86,3 +86,5 @@ grep '1BEG: maude.foo :END1' stdout
 grep '2BEG: maude.static.foo :END2' stdout
 grep '3BEG: maude3.foo :END3' stdout
 grep '4BEG: :END4' stdout
+
+:
diff --git a/t/exeext3.sh b/t/exeext3.sh
index 1bc1a10..9561c7a 100755
--- a/t/exeext3.sh
+++ b/t/exeext3.sh
@@ -36,6 +36,8 @@ $ACLOCAL
 $AUTOMAKE -Wno-override
 
 $FGREP 'maude$(EXEEXT):' Makefile.in
-test 1 = `grep 'maude.*:' Makefile.in | wc -l`
+test 1 -eq $(grep -c 'maude.*:' Makefile.in)
 $FGREP '3dldf$(EXEEXT):' Makefile.in
-test 1 = `grep '3dldf.*:' Makefile.in | wc -l`
+test 1 -eq $(grep -c '3dldf.*:' Makefile.in)
+
+:
diff --git a/t/exeext4.sh b/t/exeext4.sh
index d9099b6..693fc56 100755
--- a/t/exeext4.sh
+++ b/t/exeext4.sh
@@ -64,7 +64,7 @@ $MAKE test-cond
 
 # Only two am__EXEEXT_* variables are needed here: one for BAR, and one
 # BAZ.  The latter must use the former.
-test 2 = `grep '__EXEEXT_. =' Makefile.in | wc -l`
+test 2 -eq $(grep -c '__EXEEXT_. =' Makefile.in)
 grep 'am__EXEEXT_2 = .*am__EXEEXT_1' Makefile.in
 
 :
diff --git a/t/ext.sh b/t/ext.sh
index 08643ac..2124310 100755
--- a/t/ext.sh
+++ b/t/ext.sh
@@ -34,13 +34,10 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-for ext in f for f90 f95 F F90 F95 r m mm upc
-do
-   # Some versions of the BSD shell wrongly exit when 'set -e' is active
-   # if the last command within a compound statement fails and is guarded
-   # by an && only.  So we play safe and use the following idiom, instead
-   # of the apparently simpler 'grep ... && Exit 1'.
-   if grep "^$ext\.o:" Makefile.in; then Exit 1; else :; fi
+for ext in f for f90 f95 F F90 F95 r m mm upc; do
    grep "^\.$ext\.o:" Makefile.in
+   grep "^$ext\.o:" Makefile.in && Exit 1
+   : For shells with busted 'set -e'.
 done
-Exit 0
+
+:
diff --git a/t/extradep.sh b/t/extradep.sh
index 77b806a..8398ea6 100755
--- a/t/extradep.sh
+++ b/t/extradep.sh
@@ -48,8 +48,7 @@ EXTRA_DIST = foodep bardep
 
 .PHONY: bar-has-been-updated
 bar-has-been-updated:
-       stat older bar$(EXEEXT) libfoo.a || : For debugging.
-       test `ls -t bar$(EXEEXT) older | sed q` = bar$(EXEEXT)
+       is_newest bar$(EXEEXT) libfoo.a
 END
 
 cat >libfoo.c <<'END'
@@ -96,7 +95,6 @@ $MAKE && Exit 1
 : >bardep
 
 $MAKE
-: > older
 $sleep
 touch libfoo.a
 $MAKE
diff --git a/t/extradep2.sh b/t/extradep2.sh
index 91722bd..011a0d4 100755
--- a/t/extradep2.sh
+++ b/t/extradep2.sh
@@ -43,8 +43,7 @@ EXTRA_DIST = bardep
 
 .PHONY: bar-has-been-updated
 bar-has-been-updated:
-       stat older bar$(EXEEXT) libfoo.la || : For debugging.
-       test `ls -t bar$(EXEEXT) older | sed q` = bar$(EXEEXT)
+       is_newest bar$(EXEEXT) libfoo.la
 END
 
 cat >libfoo.c <<'END'
@@ -77,7 +76,6 @@ $MAKE && Exit 1
 : >bardep
 
 $MAKE
-: > older
 $sleep
 touch libfoo.la
 $MAKE
diff --git a/t/fn99.sh b/t/fn99.sh
index 900b36b..db7f323 100755
--- a/t/fn99.sh
+++ b/t/fn99.sh
@@ -46,6 +46,6 @@ done) || skip_ "failed to create deeper directory hierarchy"
 $MAKE dist 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep 'filenames are too long' stderr
-test 2 = `grep 12345678 stderr | wc -l`
+test 2 -eq $(grep -c 12345678 stderr)
 
 :
diff --git a/t/fn99subdir.sh b/t/fn99subdir.sh
index beb0261..0df282c 100755
--- a/t/fn99subdir.sh
+++ b/t/fn99subdir.sh
@@ -76,6 +76,6 @@ done) || skip_ "failed to create deeper directory hierarchy"
 $MAKE dist 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep 'filenames are too long' stderr
-test 1 = `grep 12345678 stderr | wc -l`
+test 1 -eq $(grep -c 12345678 stderr)
 
 :
diff --git a/t/fort4.sh b/t/fort4.sh
index a23c9bd..7315ec1 100755
--- a/t/fort4.sh
+++ b/t/fort4.sh
@@ -74,7 +74,7 @@ $AUTOCONF
 # or if the compiler cannot compile Fortran 90 files).
 ./configure
 $MAKE
-subobjs=`echo sub/*.o sub/*.obj`
+subobjs=$(echo sub/*.o sub/*.obj)
 test "$subobjs" = 'sub/*.o sub/*.obj'
 $MAKE distcheck
 
@@ -90,3 +90,5 @@ test ! -f baz.obj
 test ! -f goodbye-baz.o
 test ! -f goodbye-baz.obj
 $MAKE distcheck
+
+:
diff --git a/t/fort5.sh b/t/fort5.sh
index 4614b66..6fa1f22 100755
--- a/t/fort5.sh
+++ b/t/fort5.sh
@@ -89,7 +89,7 @@ grep " --tag=FC" Makefile.in
 # or if the compiler cannot compile Fortran 90 files).
 ./configure
 $MAKE
-subobjs=`echo sub/*.lo`
+subobjs=$(echo sub/*.lo)
 test "$subobjs" = 'sub/*.lo'
 $MAKE distcheck
 
@@ -103,3 +103,5 @@ test ! -f bar.lo
 test ! -f baz.lo
 test ! -f libgoodbye_la-baz.lo
 $MAKE distcheck
+
+:
diff --git a/t/gcj3.sh b/t/gcj3.sh
index a8ec120..36692d9 100755
--- a/t/gcj3.sh
+++ b/t/gcj3.sh
@@ -31,7 +31,6 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-num=`grep depcomp Makefile.in | wc -l`
-test $num -gt 1
+test $($FGREP -c depcomp Makefile.in) -gt 1
 
 :
diff --git a/t/gcj4.sh b/t/gcj4.sh
index a860f89..78d3fe7 100755
--- a/t/gcj4.sh
+++ b/t/gcj4.sh
@@ -32,7 +32,7 @@ END
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
-./configure >stdout
+./configure >stdout || { cat stdout; Exit 1; }
 cat stdout
 
 # Configure must be checking the dependency style of gcj ...
@@ -40,7 +40,7 @@ grep 'dependency style of gcj' stdout >filt
 cat filt
 
 # ... only once.
-test `wc -l < filt` = 1
+test $(wc -l < filt) = 1
 
 # Accept any outcome but 'none'
 # (at the time of writing it should be gcc or gcc3).
diff --git a/t/gettext-macros.sh b/t/gettext-macros.sh
index e9a4739..b1349f6 100755
--- a/t/gettext-macros.sh
+++ b/t/gettext-macros.sh
@@ -49,7 +49,7 @@ fi
 # in the AM_GNU_GETTEXT_VERSION call in configure.ac if we want autopoint
 # (or gettextize) to setup the correct infrastructure -- in particular,
 # for what concerns us, to bring in all the required .m4 files.
-autopoint_version=`extract_program_version $am_gettextize_command` \
+autopoint_version=$(extract_program_version $am_gettextize_command) \
   && test -n "$autopoint_version" \
   || autopoint_version=0.10.35
 
@@ -61,7 +61,7 @@ AM_GNU_GETTEXT
 AM_GNU_GETTEXT_VERSION([$autopoint_version])
 END
 
-if $am_gettextize_command --force && test -f m4/gettext.m4; then :; else
+if ! ($am_gettextize_command --force && test -f m4/gettext.m4); then
   # Older versions of gettext might not have a gettextize program
   # available, but this doesn't mean the user hasn't made the gettext
   # macros available, e.g., by properly setting ACLOCAL_PATH.
@@ -75,7 +75,7 @@ if $am_gettextize_command --force && test -f m4/gettext.m4; 
then :; else
   fi
 fi
 
-echo "ACLOCAL_PATH='`pwd`/m4':\$ACLOCAL_PATH" >> get.sh
+echo "ACLOCAL_PATH='$(pwd)/m4':\$ACLOCAL_PATH" >> get.sh
 echo "export ACLOCAL_PATH" >> get.sh
 
 # Even recent versions of gettext used the now-obsolete 'AM_PROG_MKDIR_P'
@@ -92,7 +92,7 @@ END
 
 # Remove any Makefile.in possibly created by gettextize/autopoint, to
 # avoid spurious maintainer-check failures.
-rm -f `find . -name Makefile.in`
+rm -f $(find . -name Makefile.in)
 
 # The file gettextize or autopoint might have copied in the 'm4'
 # subdirectory of the test directory are going to be needed by
diff --git a/t/gnits2.sh b/t/gnits2.sh
index ef7078c..6bc9146 100755
--- a/t/gnits2.sh
+++ b/t/gnits2.sh
@@ -104,7 +104,7 @@ mkdir build
 cd build
 
 # Use --program-prefix to make sure the std-options check honors it.
-../configure "--prefix=`pwd`/../inst-dir" --program-prefix=p
+../configure "--prefix=$(pwd)/../inst-dir" --program-prefix=p
 $MAKE all
 $MAKE test-install
 $MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k.
diff --git a/t/gnits3.sh b/t/gnits3.sh
index f479762..d8baf7c 100755
--- a/t/gnits3.sh
+++ b/t/gnits3.sh
@@ -83,7 +83,7 @@ mkdir build
 cd build
 
 # Use --program-prefix to make sure the std-options check honors it.
-../configure "--prefix=`pwd`/../inst-dir" --program-prefix=p
+../configure "--prefix=$(pwd)/../inst-dir" --program-prefix=p
 $MAKE
 $MAKE install
 $MAKE installcheck && Exit 1
diff --git a/t/hdr-vars-defined-once.sh b/t/hdr-vars-defined-once.sh
index 1e31cd2..de868a8 100755
--- a/t/hdr-vars-defined-once.sh
+++ b/t/hdr-vars-defined-once.sh
@@ -31,8 +31,7 @@ END
 
 $ACLOCAL
 $AUTOMAKE
-len=`grep '^srcdir' Makefile.in | wc -l`
-test $len -eq 1
+test $(grep -c '^srcdir' Makefile.in) -eq 1
 
 # Also make sure include file is distributed.
 sed -n -e '/^DIST_COMMON =.*\\$/ {
diff --git a/t/help-silent.sh b/t/help-silent.sh
index aaa6b6a..dbf45a0 100755
--- a/t/help-silent.sh
+++ b/t/help-silent.sh
@@ -24,17 +24,15 @@ $ACLOCAL
 
 cp configure.ac configure.tmpl
 
-q="[\`'\"]"
-
 for args in '' 'yes' 'no'; do
   cp -f configure.tmpl configure.ac
   test x"$args" = x || echo "AM_SILENT_RULES([$args])/" >> configure.ac
   cat configure.ac # For debugging.
   $AUTOCONF --force
   grep_configure_help --enable-silent-rules \
-                      " less verbose build.*\\(undo.*${q}make V=1${q}"
+                      ' less verbose build.*\(undo.*"make V=1".*\)'
   grep_configure_help --disable-silent-rules \
-                      " verbose build.*\\(undo.*${q}make V=0${q}"
+                      ' verbose build.*\(undo.*"make V=0".*\)'
 done
 
 :
diff --git a/t/help4.sh b/t/help4.sh
index 9747968..d51e0c4 100755
--- a/t/help4.sh
+++ b/t/help4.sh
@@ -29,7 +29,7 @@ ACLOCAL=$am_original_ACLOCAL
 AUTOMAKE=$am_original_AUTOMAKE
 
 escape_dots () { sed 's/\./\\./g'; } # Avoid issues with "\" in backquotes.
-apiversion_rx=`echo "$APIVERSION" | escape_dots`
+apiversion_rx=$(echo "$APIVERSION" | escape_dots)
 
 $ACLOCAL --version --help >stdout || { cat stdout; Exit 1; }
 cat stdout
diff --git a/t/info.sh b/t/info.sh
index 738ddfd..b0b240f 100755
--- a/t/info.sh
+++ b/t/info.sh
@@ -30,7 +30,7 @@ echo '@setfilename foo.info' > foo.texi
 $ACLOCAL
 $AUTOMAKE
 
-for i in `grep '^INFOS =' Makefile.in | sed -e 's/^INFOS = //'`; do
+for i in $(grep '^INFOS =' Makefile.in | sed -e 's/^INFOS = //'); do
    echo $i
    case "$i" in
     foo*)
diff --git a/t/install-info-dir.sh b/t/install-info-dir.sh
index 12b2293..0b0521b 100755
--- a/t/install-info-dir.sh
+++ b/t/install-info-dir.sh
@@ -24,7 +24,7 @@
 required=makeinfo
 . ./defs || Exit 1
 
-cwd=`pwd` || fatal_ "cannot get current working directory"
+cwd=$(pwd) || fatal_ "cannot get current working directory"
 
 mkdir bin
 saved_PATH=$PATH; export saved_PATH
diff --git a/t/installdir.sh b/t/installdir.sh
index dc83ee3..9b2bc57 100755
--- a/t/installdir.sh
+++ b/t/installdir.sh
@@ -36,9 +36,9 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-test `grep installdirs-local Makefile.in | wc -l` -eq 4
+test $(grep -c installdirs-local Makefile.in) -eq 4
 
-cwd=`pwd` || fatal_ "getting current working directory"
+cwd=$(pwd) || fatal_ "getting current working directory"
 
 $AUTOCONF
 ./configure --prefix="$cwd/inst"
diff --git a/t/instdir-cond.sh b/t/instdir-cond.sh
index 2965ff1..abab752 100755
--- a/t/instdir-cond.sh
+++ b/t/instdir-cond.sh
@@ -39,7 +39,7 @@ $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
 
-./configure --prefix="`pwd`/inst"
+./configure --prefix="$(pwd)/inst"
 
 $MAKE install
 test ! -d inst/share/instdir-cond
diff --git a/t/instdir-cond2.sh b/t/instdir-cond2.sh
index 1fc24b7..6be0883 100755
--- a/t/instdir-cond2.sh
+++ b/t/instdir-cond2.sh
@@ -43,7 +43,7 @@ $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
 
-./configure --prefix="`pwd`/inst"
+./configure --prefix="$(pwd)/inst"
 
 $MAKE installdirs
 test ! -d inst || { find inst; Exit 1; }
diff --git a/t/instdir-java.sh b/t/instdir-java.sh
index 4d47d19..83361d4 100755
--- a/t/instdir-java.sh
+++ b/t/instdir-java.sh
@@ -37,8 +37,9 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
-destdir=`pwd`/dest
+cwd=$(pwd) || fatal_ "getting current working directory"
+instdir=$cwd/inst
+destdir=$cwd/dest
 mkdir build
 cd build
 ../configure --prefix="$instdir"
diff --git a/t/instdir-lisp.sh b/t/instdir-lisp.sh
index f019504..eebf5da 100755
--- a/t/instdir-lisp.sh
+++ b/t/instdir-lisp.sh
@@ -34,8 +34,9 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
-destdir=`pwd`/dest
+cwd=$(pwd) || fatal_ "getting current working directory"
+instdir=$cwd/inst
+destdir=$cwd/dest
 mkdir build
 cd build
 ../configure --prefix="$instdir"
diff --git a/t/instdir-ltlib.sh b/t/instdir-ltlib.sh
index ded16cd..3d04d2c 100755
--- a/t/instdir-ltlib.sh
+++ b/t/instdir-ltlib.sh
@@ -59,8 +59,9 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
-destdir=`pwd`/dest
+cwd=$(pwd) || fatal_ "getting current working directory"
+instdir=$cwd/inst
+destdir=$cwd/dest
 mkdir build
 cd build
 ../configure --prefix="$instdir" PYTHON="echo" \
diff --git a/t/instdir-no-empty.sh b/t/instdir-no-empty.sh
index d93add8..f86365f 100755
--- a/t/instdir-no-empty.sh
+++ b/t/instdir-no-empty.sh
@@ -95,7 +95,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-cwd=`pwd` || fatal_ "getting current working directory"
+cwd=$(pwd) || fatal_ "getting current working directory"
 
 doinst ()
 {
diff --git a/t/instdir-prog.sh b/t/instdir-prog.sh
index e0948c0..d459f0e 100755
--- a/t/instdir-prog.sh
+++ b/t/instdir-prog.sh
@@ -58,8 +58,9 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
-destdir=`pwd`/dest
+cwd=$(pwd) || fatal_ "getting current working directory"
+instdir=$cwd/inst
+destdir=$cwd/dest
 mkdir build
 cd build
 ../configure --prefix="$instdir" PYTHON="echo" \
diff --git a/t/instdir-python.sh b/t/instdir-python.sh
index f48353d..c15370e 100755
--- a/t/instdir-python.sh
+++ b/t/instdir-python.sh
@@ -38,8 +38,9 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
-destdir=`pwd`/dest
+cwd=$(pwd) || fatal_ "getting current working directory"
+instdir=$cwd/inst
+destdir=$cwd/dest
 mkdir build
 cd build
 ../configure --prefix="$instdir"
diff --git a/t/instdir-texi.sh b/t/instdir-texi.sh
index 8523993..dc74285 100755
--- a/t/instdir-texi.sh
+++ b/t/instdir-texi.sh
@@ -47,8 +47,9 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
-destdir=`pwd`/dest
+cwd=$(pwd) || fatal_ "getting current working directory"
+instdir=$cwd/inst
+destdir=$cwd/dest
 mkdir build
 cd build
 ../configure --prefix="$instdir"
diff --git a/t/instdir.sh b/t/instdir.sh
index f09fdfa..06821ed 100755
--- a/t/instdir.sh
+++ b/t/instdir.sh
@@ -47,8 +47,9 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
-destdir=`pwd`/dest
+cwd=$(pwd) || fatal_ "getting current working directory"
+instdir=$cwd/inst
+destdir=$cwd/dest
 mkdir build
 cd build
 ../configure --prefix="$instdir"
diff --git a/t/instdir2.sh b/t/instdir2.sh
index bdfa809..d12d390 100755
--- a/t/instdir2.sh
+++ b/t/instdir2.sh
@@ -69,8 +69,9 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
-destdir=`pwd`/dest
+cwd=$(pwd) || fatal_ "getting current working directory"
+instdir=$cwd/inst
+destdir=$cwd/dest
 mkdir build
 cd build
 ../configure --prefix="$instdir"
diff --git a/t/instfail-info.sh b/t/instfail-info.sh
index 58aef97..257f9a0 100755
--- a/t/instfail-info.sh
+++ b/t/instfail-info.sh
@@ -45,7 +45,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
+instdir=$(pwd)/inst || fatal_ "getting current working directory"
 ./configure --prefix="$instdir"
 $MAKE
 
diff --git a/t/instfail-java.sh b/t/instfail-java.sh
index 0ae80f5..b602517 100755
--- a/t/instfail-java.sh
+++ b/t/instfail-java.sh
@@ -39,7 +39,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
+instdir=$(pwd)/inst || fatal_ "getting current working directory"
 ./configure --prefix="$instdir"
 $MAKE
 
diff --git a/t/instfail-libtool.sh b/t/instfail-libtool.sh
index 0acfd2c..b5a0d16 100755
--- a/t/instfail-libtool.sh
+++ b/t/instfail-libtool.sh
@@ -55,7 +55,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
+instdir=$(pwd)/inst || fatal_ "getting current working directory"
 ./configure --prefix="$instdir"
 $MAKE
 
diff --git a/t/instfail.sh b/t/instfail.sh
index 1e5a340..eb4c269 100755
--- a/t/instfail.sh
+++ b/t/instfail.sh
@@ -60,7 +60,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
+instdir=$(pwd)/inst || fatal_ "getting current working directory"
 ./configure --prefix="$instdir"
 $MAKE
 
@@ -83,9 +83,8 @@ $MAKE unreadable-progn
 $MAKE install-exec && Exit 1
 $MAKE readable-progn
 
-if grep "^EMACS = no" Makefile; then :; else
-  for file in lisp1.el lisp1.elc
-  do
+if ! grep "^EMACS = no" Makefile; then
+  for file in lisp1.el lisp1.elc; do
     chmod a-r $file
     $MAKE install-data && Exit 1
     chmod u+r $file
diff --git a/t/insthook.sh b/t/insthook.sh
index 23bc4e0..7fe0278 100755
--- a/t/insthook.sh
+++ b/t/insthook.sh
@@ -56,7 +56,7 @@ test -f ok
 # second version will overwrite 'foo'.  Hopefully 'install' and 'install-sh'
 # are smart enough to erase the 'foo' symlink before installing the new
 # version.)
-./configure "--bindir=`pwd`/bin"
+./configure "--bindir=$(pwd)/bin"
 $MAKE install
 echo 2 > foo
 VERSION=2.0 $MAKE -e install
diff --git a/t/instman.sh b/t/instman.sh
index 7871045..114dc71 100755
--- a/t/instman.sh
+++ b/t/instman.sh
@@ -30,5 +30,7 @@ EOF
 $ACLOCAL
 $AUTOMAKE
 
-grep '[^(/]MKDIR_P' Makefile.in > out
-test `wc -l < out` -eq 1
+grep 'MKDIR_P' Makefile.in # For debugging.
+test $(grep -c '[^(/]MKDIR_P' Makefile.in) -eq 1
+
+:
diff --git a/t/instmany-mans.sh b/t/instmany-mans.sh
index ceb3a9e..682fc1d 100755
--- a/t/instmany-mans.sh
+++ b/t/instmany-mans.sh
@@ -28,7 +28,7 @@
 limit=2500
 subdir=long_subdir_name_with_many_characters
 nfiles=81
-list=`seq_ 1 $nfiles`
+list=$(seq_ 1 $nfiles)
 
 sed "s|@limit@|$limit|g" >myinstall.in <<'END'
 #! /bin/sh
@@ -100,7 +100,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
+instdir=$(pwd)/inst
 mkdir build
 cd build
 ../configure --prefix="$instdir"
@@ -110,11 +110,11 @@ $MAKE install
 # Multiple uninstall should work, too.
 $MAKE uninstall
 $MAKE uninstall
-test `find "$instdir" -type f -print | wc -l` = 0
+test $(find "$instdir" -type f -print | wc -l) -eq 0
 
 # Try whether we don't exceed the low limit.
 INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install
-env save_PATH="$PATH" PATH="`pwd`/..$PATH_SEPARATOR$PATH" $MAKE uninstall
+env save_PATH="$PATH" PATH="$(pwd)/..$PATH_SEPARATOR$PATH" $MAKE uninstall
 
 cd $subdir
 srcdir=../../$subdir
diff --git a/t/instmany-python.sh b/t/instmany-python.sh
index d0c5b1a..d6dd118 100755
--- a/t/instmany-python.sh
+++ b/t/instmany-python.sh
@@ -24,7 +24,7 @@ required='python'
 limit=2500
 subdir=long_subdir_name_with_many_characters
 nfiles=81
-list=`seq_ 1 $nfiles`
+list=$(seq_ 1 $nfiles)
 
 sed "s|@limit@|$limit|g" >myinstall.in <<'END'
 #! /bin/sh
@@ -91,7 +91,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
+instdir=$(pwd)/inst
 mkdir build
 cd build
 ../configure --prefix="$instdir"
@@ -101,11 +101,11 @@ $MAKE install
 # Multiple uninstall should work, too.
 $MAKE uninstall
 $MAKE uninstall
-test `find "$instdir" -type f -print | wc -l` = 0
+test $(find "$instdir" -type f -print | wc -l) -eq 0
 
 # Try whether we don't exceed the low limit.
 INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install
-env save_PATH="$PATH" PATH="`pwd`/..$PATH_SEPARATOR$PATH" $MAKE uninstall
+env save_PATH="$PATH" PATH="$(pwd)/..$PATH_SEPARATOR$PATH" $MAKE uninstall
 
 cd $subdir
 srcdir=../../$subdir
diff --git a/t/instmany.sh b/t/instmany.sh
index d334ebe..7721f7d 100755
--- a/t/instmany.sh
+++ b/t/instmany.sh
@@ -36,7 +36,7 @@
 limit=2500
 subdir=long_subdir_name_with_many_characters
 nfiles=81
-list=`seq_ 1 $nfiles`
+list=$(seq_ 1 $nfiles)
 
 sed "s|@limit@|$limit|g" >myinstall.in <<'END'
 #! /bin/sh
@@ -114,7 +114,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-instdir=`pwd`/inst
+instdir=$(pwd)/inst
 mkdir build
 cd build
 ../configure --prefix="$instdir"
@@ -124,11 +124,11 @@ $MAKE install
 # Multiple uninstall should work, too.
 $MAKE uninstall
 $MAKE uninstall
-test `find "$instdir" -type f -print | wc -l` = 0
+test $(find "$instdir" -type f -print | wc -l) -eq 0
 
 # Try whether we don't exceed the low limit.
 INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install
-env save_PATH="$PATH" PATH="`pwd`/..$PATH_SEPARATOR$PATH" $MAKE uninstall
+env save_PATH="$PATH" PATH="$(pwd)/..$PATH_SEPARATOR$PATH" $MAKE uninstall
 
 cd $subdir
 srcdir=../../$subdir
diff --git a/t/instspc.tap b/t/instspc.tap
index cbe0fdf..a6f7763 100755
--- a/t/instspc.tap
+++ b/t/instspc.tap
@@ -219,8 +219,8 @@ if test $# -gt 0; then
     esac
   done
   # We need to determine the TAP plan adaptively.
-  n=`for t in $test_names_list; do echo $t; done | wc -l`
-  plan_ `expr $n '*' 2` # Two tests per "problematic string".
+  n=$(for t in $test_names_list; do echo $t; done | wc -l)
+  plan_ $(($n * 2)) # Two tests per "problematic string".
   unset n
 else
   test_names_list=$all_test_names_list
@@ -228,7 +228,7 @@ else
   plan_ 94
 fi
 
-ocwd=`pwd` || fatal_ "cannot get current working directory"
+ocwd=$(pwd) || fatal_ "getting current working directory"
 
 create_input_data
 
@@ -324,10 +324,10 @@ for test_name in $test_names_list; do
     # the test directory not to be removed when the script terminates.
     if not am_keeping_testdirs && test "$r" = ok; then
       rm_rf_ "$build" "$dest" || fatal_ "removing temporary subdirectory"
-    else
-      : For lesser shells with broken 'set -e'.
     fi
 
+    : For shells with busted 'set -e'.
+
   done # $instspc_action
 
 done # $test_name
diff --git a/t/java-check.sh b/t/java-check.sh
index 230fb96..15c0e45 100755
--- a/t/java-check.sh
+++ b/t/java-check.sh
@@ -41,7 +41,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-inst=`pwd`/_inst
+inst=$(pwd)/_inst
 
 ./configure --prefix="$inst"
 
diff --git a/t/java-compile-install.sh b/t/java-compile-install.sh
index f3340ff..448a839 100755
--- a/t/java-compile-install.sh
+++ b/t/java-compile-install.sh
@@ -87,7 +87,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-./configure --prefix="`pwd`"/_inst
+./configure --prefix="$(pwd)"/_inst
 $MAKE
 $MAKE test
 $MAKE install
diff --git a/t/java-compile-run-flat.sh b/t/java-compile-run-flat.sh
index 3a8fcad..eb384c5 100755
--- a/t/java-compile-run-flat.sh
+++ b/t/java-compile-run-flat.sh
@@ -230,7 +230,7 @@ $AUTOMAKE
 # To have the parallel testsuite more verbose.
 VERBOSE=yes; export VERBOSE
 
-./configure --prefix="`pwd`/_inst"
+./configure --prefix="$(pwd)/_inst"
 cat PkgLocation.java # For debugging.
 $MAKE check
 $MAKE install
diff --git a/t/java-compile-run-nested.sh b/t/java-compile-run-nested.sh
index ece2d1c..f5b7b95 100755
--- a/t/java-compile-run-nested.sh
+++ b/t/java-compile-run-nested.sh
@@ -239,7 +239,7 @@ $AUTOMAKE -a
 # To have the parallel testsuite more verbose.
 VERBOSE=yes; export VERBOSE
 
-./configure --prefix="`pwd`/_inst"
+./configure --prefix="$(pwd)/_inst"
 cat jprog/PkgLocation.java # For debugging.
 $MAKE check
 $MAKE install
diff --git a/t/java-no-duplicate.sh b/t/java-no-duplicate.sh
index 416fdb9..d7ea5f2 100755
--- a/t/java-no-duplicate.sh
+++ b/t/java-no-duplicate.sh
@@ -36,10 +36,10 @@ $EGREP -i '\.stamp|\.class|java|classpath' Makefile.in # 
For debugging.
 
 for var in JAVAC JAVAROOT CLASSPATH_ENV am__java_sources; do
   grep "^$var =" Makefile.in
-  test `grep -c "^[$sp$tab]*$var[$sp$tab]*=" Makefile.in` = 1
+  test $(grep -c "^[$sp$tab]*$var[$sp$tab]*=" Makefile.in) -eq 1
 done
 
 grep '^classjava\.stamp:' Makefile.in
-test `grep -c "class.*java.*\.stamp.*:" Makefile.in` = 1
+test $(grep -c "class.*java.*\.stamp.*:" Makefile.in) -eq 1
 
 :
diff --git a/t/java-nobase.sh b/t/java-nobase.sh
index ff72a13..7a1ca44 100755
--- a/t/java-nobase.sh
+++ b/t/java-nobase.sh
@@ -56,7 +56,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-./configure --prefix="`pwd`"/_inst
+./configure --prefix="$(pwd)"/_inst
 $MAKE check
 $MAKE install
 $MAKE test-install
diff --git a/t/java-noinst.sh b/t/java-noinst.sh
index b11e6a0..cf0c600 100755
--- a/t/java-noinst.sh
+++ b/t/java-noinst.sh
@@ -41,7 +41,7 @@ $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
 
-./configure --prefix="`pwd`/_inst"
+./configure --prefix="$(pwd)/_inst"
 
 $MAKE
 ls -l
diff --git a/t/java-uninstall.sh b/t/java-uninstall.sh
index fb6bfa1..e637f6a 100755
--- a/t/java-uninstall.sh
+++ b/t/java-uninstall.sh
@@ -56,7 +56,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-./configure --prefix="`pwd`"/_inst
+./configure --prefix="$(pwd)"/_inst
 javadir=_inst/java
 
 check_uninstallation()
diff --git a/t/java.sh b/t/java.sh
index 16b1250..8ba2dc1 100755
--- a/t/java.sh
+++ b/t/java.sh
@@ -34,19 +34,12 @@ $AUTOMAKE
 
 $EGREP '\.stamp|class' Makefile.in # For debugging.
 grep '^all[-a-z]*:.*classjava\.stamp' Makefile.in
-test `grep -c '^all[-a-z]*:.*classjava\.stamp' Makefile.in` -eq 1
+test $(grep -c '^all[-a-z]*:.*classjava\.stamp' Makefile.in) -eq 1
 
-cat >a.java <<EOF
-class a
-{
-}
-EOF
-
-cat >b.java <<EOF
-class b
-{
-}
-EOF
+echo 'class a { }' > a.java
+echo 'class b { }' > b.java
 
-./configure --prefix "`pwd`"
+./configure
 $MAKE distcheck
+
+:
diff --git a/t/java3.sh b/t/java3.sh
index 7d94635..356d0c2 100755
--- a/t/java3.sh
+++ b/t/java3.sh
@@ -42,8 +42,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-cwd=`pwd` || Exit 1
-./configure --prefix="$cwd/_inst"
+./configure --prefix="$(pwd)/_inst"
 $MAKE
 $MAKE install
 ls -l .
diff --git a/t/lex-depend-cxx.sh b/t/lex-depend-cxx.sh
index 7bdfdf9..ec592f7 100755
--- a/t/lex-depend-cxx.sh
+++ b/t/lex-depend-cxx.sh
@@ -40,9 +40,8 @@ test-deps-exist:
 
 .PHONY: test-obj-updated
 test-obj-updated: joe.$(OBJEXT) moe.$(OBJEXT)
-       stat older my-hdr.hxx joe.$(OBJEXT) moe.$(OBJEXT) || :
-       test `ls -t older joe.$(OBJEXT) | sed 1q` = joe.$(OBJEXT)
-       test `ls -t older moe.$(OBJEXT) | sed 1q` = moe.$(OBJEXT)
+       is_newest joe.$(OBJEXT) my-hdr.hxx
+       is_newest moe.$(OBJEXT) my-hdr.hxx
 END
 
 cat > joe.ll << 'END'
@@ -86,7 +85,6 @@ $AUTOCONF
 $MAKE test-deps-exist
 $MAKE
 
-: > older
 $sleep
 touch my-hdr.hxx
 $MAKE test-obj-updated
diff --git a/t/lex-depend.sh b/t/lex-depend.sh
index fce198d..be7da7f 100755
--- a/t/lex-depend.sh
+++ b/t/lex-depend.sh
@@ -38,8 +38,7 @@ test-deps-exist:
 
 .PHONY: test-obj-updated
 test-obj-updated: joe.$(OBJEXT)
-       stat older my-hdr.h joe.$(OBJEXT) || : For debugging.
-       test `ls -t older joe.$(OBJEXT) | sed 1q` = joe.$(OBJEXT)
+       is_newest joe.$(OBJEXT) my-hdr.h
 END
 
 cat > joe.l << 'END'
@@ -80,10 +79,15 @@ $AUTOCONF
 
 $MAKE test-deps-exist
 $MAKE
+cross_compiling || test "$(./zoo)" = 'Hello, World!' || Exit 1
 
-: > older
 $sleep
-touch my-hdr.h
+cat >> my-hdr.h << 'END'
+#undef MESSAGE
+#define MESSAGE "Howdy, Earth!"
+END
 $MAKE test-obj-updated
+$MAKE
+cross_compiling || test "$(./zoo)" = 'Howdy, Earth!' || Exit 1
 
 :
diff --git a/t/lex-lib-external.sh b/t/lex-lib-external.sh
index 21802c5..df8aa00 100755
--- a/t/lex-lib-external.sh
+++ b/t/lex-lib-external.sh
@@ -69,7 +69,7 @@ $MAKE have-lexlib || skip_ "no system-wide lex library found"
 
 # Program should build and run and distribute.
 $MAKE all
-if cross_compiling; then :; else
+if ! cross_compiling; then
   echo GOOD | ./lexer
   echo BAD | ./lexer && Exit 1
   : For shells with busted 'set -e'.
diff --git a/t/lex-noyywrap.sh b/t/lex-noyywrap.sh
index 1c4a13b..7335279 100755
--- a/t/lex-noyywrap.sh
+++ b/t/lex-noyywrap.sh
@@ -63,7 +63,7 @@ $AUTOMAKE -a
 
 # Program should build and run.
 $MAKE
-if cross_compiling; then :; else
+if ! cross_compiling; then
   echo GOOD | ./foo
   echo BAD | ./foo && Exit 1
   : For shells with busted 'set -e'.
diff --git a/t/lex-pr204.sh b/t/lex-pr204.sh
index 3ebb572..1fc64ad 100755
--- a/t/lex-pr204.sh
+++ b/t/lex-pr204.sh
@@ -82,8 +82,7 @@ $sleep
 touch lexer.l lexer2.l
 $sleep
 $MAKE lexer.c lexer2.c
-stat lexer.c lexer.l lexer2.c lexer2.l || : # For debugging.
-test `ls -t lexer.c lexer.l | sed 1q` = lexer.c
-test `ls -t lexer2.c lexer2.l | sed 1q` = lexer2.c
+is_newest lexer.c lexer.l
+is_newest lexer2.c lexer2.l
 
 :
diff --git a/t/lex3.sh b/t/lex3.sh
index 125152b..78cf11c 100755
--- a/t/lex3.sh
+++ b/t/lex3.sh
@@ -66,7 +66,7 @@ $AUTOMAKE -a
 
 # Program should build and run.
 $MAKE
-if cross_compiling; then :; else
+if ! cross_compiling; then
   echo GOOD | ./foo
   echo BAD | ./foo && Exit 1
   : For shells with busted 'set -e'.
diff --git a/t/library3.sh b/t/library3.sh
index 27a2b15..daf96b9 100755
--- a/t/library3.sh
+++ b/t/library3.sh
@@ -49,4 +49,6 @@ $ACLOCAL
 AUTOMAKE_fails
 grep '^Makefile.am:.*:   !A and !C and !D$' stderr
 # Is there only one missing condition?
-test `grep ':   !' stderr | wc -l` = 1 || Exit 1
+test $(grep -c ':   !' stderr) -eq 1
+
+:
diff --git a/t/libtool-macros.sh b/t/libtool-macros.sh
index e5c77ac..f2f8811 100755
--- a/t/libtool-macros.sh
+++ b/t/libtool-macros.sh
@@ -27,7 +27,7 @@ echo : >> get.sh
 echo ACLOCAL_AMFLAGS = -I m4 > Makefile.am
 
 if libtoolize --copy --install && test -f m4/libtool.m4; then
-  echo "ACLOCAL_PATH='`pwd`/m4':\$ACLOCAL_PATH" >> get.sh
+  echo "ACLOCAL_PATH='$(pwd)/m4':\$ACLOCAL_PATH" >> get.sh
   echo "export ACLOCAL_PATH" >> get.sh
 else
   # Libtoolize from libtool < 2.0 didn't support the '--install' option,
diff --git a/t/libtool6.sh b/t/libtool6.sh
index 13dbc73..7655569 100755
--- a/t/libtool6.sh
+++ b/t/libtool6.sh
@@ -42,4 +42,6 @@ libtoolize
 $ACLOCAL
 $AUTOMAKE --add-missing
 # am_liba_la_rpath is defined twice, and used once
-test 3 = `grep 'am_liba_la_rpath' Makefile.in | wc -l`
+test 3 -eq $(grep -c 'am_liba_la_rpath' Makefile.in)
+
+:
diff --git a/t/libtool7.sh b/t/libtool7.sh
index bc8eaca..6dc6aeb 100755
--- a/t/libtool7.sh
+++ b/t/libtool7.sh
@@ -78,7 +78,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing --copy
 
-./configure "--prefix=`pwd`/_inst"
+./configure "--prefix=$(pwd)/_inst"
 env LIBTOOLFLAGS=--silent $MAKE print >output 2>&1 || {
   cat output
   Exit 1
@@ -87,7 +87,7 @@ cat output
 grep '1BEG: libmod1.la mod2.la :END1' output
 grep '2BEG: mod2.la :END2' output
 grep '3BEG: .*silent.*silent.* :END3' output
-test 2 -le `grep mod2_la_LIBTOOLFLAGS Makefile | wc -l`
+test 2 -le $(grep mod2_la_LIBTOOLFLAGS Makefile | wc -l)
 $MAKE
 
 env LIBTOOLFLAGS=--silent $MAKE install >output 2>&1 || {
diff --git a/t/lisp3.sh b/t/lisp3.sh
index a1531d3..0d8be77 100755
--- a/t/lisp3.sh
+++ b/t/lisp3.sh
@@ -40,7 +40,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-./configure --prefix="`pwd`/_inst"
+./configure --prefix="$(pwd)/_inst"
 
 $MAKE
 
diff --git a/t/lisp4.sh b/t/lisp4.sh
index 8d2de59..82109f5 100755
--- a/t/lisp4.sh
+++ b/t/lisp4.sh
@@ -60,7 +60,9 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-./configure --prefix "`pwd`"
+cwd=$(pwd) || fatal_ "getting current working directory"
+
+./configure --prefix "$cwd"
 $MAKE
 $MAKE test
 $MAKE install-test
@@ -70,7 +72,7 @@ $MAKE not-installed
 # Fake the absence of emacs.
 # *.el files should not be installed, but "make install" and
 # "make uninstall" should continue to work.
-./configure EMACS=no --prefix "`pwd`"
+./configure EMACS=no --prefix "$cwd"
 $MAKE
 $MAKE test
 $MAKE install
diff --git a/t/lisp5.sh b/t/lisp5.sh
index 997a56e..34edf3b 100755
--- a/t/lisp5.sh
+++ b/t/lisp5.sh
@@ -59,7 +59,9 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-./configure --prefix "`pwd`"
+cwd=$(pwd) || fatal_ "getting current working directory"
+
+./configure --prefix "$cwd"
 $MAKE
 $MAKE test
 $MAKE install-test
@@ -69,7 +71,7 @@ $MAKE not-installed
 # Fake the absence of emacs.
 # *.el files SHOULD be installed by "make install" (and uninstalled
 # by "make uninstall").
-./configure EMACS=no --prefix "`pwd`"
+./configure EMACS=no --prefix "$cwd"
 $MAKE
 $MAKE test
 $MAKE install-test
diff --git a/t/lisp6.sh b/t/lisp6.sh
index 9635ea2..1e3bc41 100755
--- a/t/lisp6.sh
+++ b/t/lisp6.sh
@@ -38,6 +38,9 @@ AM_PATH_LISPDIR
 AC_OUTPUT
 EOF
 
+# Avoid possible spurious influences from the environment.
+want_two=; unset want_two
+
 echo "(provide 'am-one)" > am-one.el
 echo "(require 'am-one)" > am-two.el
 echo "(require 'am-one)" > am-three.el
@@ -46,7 +49,9 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-./configure "--with-lispdir=`pwd`/lisp"
+cwd=$(pwd) || fatal_ "getting current working directory"
+
+./configure --with-lispdir="$cwd/lisp"
 
 $MAKE
 test -f am-one.elc
@@ -70,7 +75,7 @@ test ! -f am-two.elc
 test ! -f am-three.elc
 test ! -f elc-stamp
 
-./configure "--with-lispdir=`pwd`/lisp" want_two=1
+./configure --with-lispdir="$cwd/lisp" want_two=1
 
 $MAKE
 test -f am-one.elc
diff --git a/t/lisp7.sh b/t/lisp7.sh
index 79799d1..6022334 100755
--- a/t/lisp7.sh
+++ b/t/lisp7.sh
@@ -39,7 +39,7 @@ $AUTOMAKE --add-missing
 
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
-test 1 -eq `grep 'Warnings can be ignored' stdout | wc -l`
+test 1 -eq $(grep -c 'Warnings can be ignored' stdout)
 
 test ! -f am-one.elc
 test ! -f am-two.elc
diff --git a/t/lisp8.sh b/t/lisp8.sh
index 738cbd6..8c1982b 100755
--- a/t/lisp8.sh
+++ b/t/lisp8.sh
@@ -42,7 +42,7 @@ $AUTOMAKE --add-missing
 $MAKE -j >>stdout || { cat stdout; Exit 1; }
 
 cat stdout
-test 1 -eq `grep 'Warnings can be ignored' stdout | wc -l`
+test 1 -eq $(grep -c 'Warnings can be ignored' stdout)
 
 test -f am-one.elc
 test -f am-two.elc
@@ -56,7 +56,7 @@ rm -f am-*.elc
 $MAKE -j >>stdout || { cat stdout; Exit 1; }
 
 cat stdout
-test 1 -eq `grep 'Warnings can be ignored' stdout | wc -l`
+test 1 -eq $(grep -c 'Warnings can be ignored' stdout)
 test -f am-one.elc
 test -f am-two.elc
 test -f am-three.elc
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index b80c071..e701360 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -947,7 +947,6 @@ t/self-check-is_newest.tap \
 t/self-check-me.tap \
 t/self-check-reexec.tap \
 t/self-check-report.sh \
-t/self-check-sanity.sh \
 t/self-check-seq.tap \
 t/self-check-is-blocked-signal.tap \
 t/self-check-tap.sh \
diff --git a/t/longlin2.sh b/t/longlin2.sh
index 1ba8072..ab3d5d4 100755
--- a/t/longlin2.sh
+++ b/t/longlin2.sh
@@ -19,16 +19,14 @@
 
 . ./defs || Exit 1
 
-n=1
-files=
-match=
+n=1 files= match=
 while test $n -le 100
 do
   files="$files filename$n"
   match="..........$match"
-  n=`expr $n + 1`
+  n=$(($n + 1))
 done
-files2=`echo "$files" | sed s/filename/filenameb/g`
+files2=$(echo "$files" | sed s/filename/filenameb/g)
 
 cat >Makefile.am <<EOF
 FOO = $files $files2 \
@@ -46,3 +44,5 @@ $AUTOMAKE
 
 grep $match Makefile.in && Exit 1
 grep 'filenameb100 grepme' Makefile.in
+
+:
diff --git a/t/longline.sh b/t/longline.sh
index dd5664d..0c7e09e 100755
--- a/t/longline.sh
+++ b/t/longline.sh
@@ -27,4 +27,6 @@ done) > Makefile.am
 
 $ACLOCAL
 $AUTOMAKE
-test 80 -ge `grep DUMMY Makefile.in | wc -c`
+test 80 -ge $(grep DUMMY Makefile.in | wc -c)
+
+:
diff --git a/t/ltcond.sh b/t/ltcond.sh
index d5098ea..7562d92 100755
--- a/t/ltcond.sh
+++ b/t/ltcond.sh
@@ -61,10 +61,12 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
+cwd=$(pwd) || fatal_ "getting current working directory"
+
 # Install libraries in lib/, and the rest in empty/.
 # (in fact there is no "rest", so as the name imply empty/ is
 # expected to remain empty).
-./configure "--prefix=`pwd`/empty" "--libdir=`pwd`/lib"
+./configure --prefix="$cwd/empty" --libdir="$cwd/lib"
 
 $MAKE
 test -f lib1foo.la
@@ -85,12 +87,11 @@ test -f lib/lib1bar.la
 test -f lib/lib2foo.la
 test ! -f lib/lib3foo.la
 find empty -type f -print > empty.lst
-cat empty.lst
-test 0 = `wc -l < empty.lst`
+test -s empty.lst && { cat empty.lst; Exit 1; }
 
 $MAKE uninstall
 find lib -type f -print > lib.lst
-test 0 = `wc -l < lib.lst`
+test -s lib.lst && { cat lib.lst; Exit 1; }
 test -f lib1foo.la
 test -f lib1bar.la
 test -f lib2foo.la
diff --git a/t/ltconv.sh b/t/ltconv.sh
index 19ed8b3..7a62585 100755
--- a/t/ltconv.sh
+++ b/t/ltconv.sh
@@ -110,10 +110,12 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
+cwd=$(pwd) || fatal_ "getting current working directory"
+
 # Install libraries in lib/, programs in bin/, and the rest in empty/.
 # (in fact there is no "rest", so as the name imply empty/ is
 # expected to remain empty).
-./configure "--prefix=`pwd`/empty" "--libdir=`pwd`/lib" "--bindir=`pwd`/bin"
+./configure --prefix="$cwd/empty" --libdir="$cwd/lib" --bindir="$cwd/bin"
 
 $MAKE
 test -f libtop.la
@@ -132,8 +134,7 @@ test -f installcheck-ok
 rm -f installcheck-ok
 
 find empty -type f -print > empty.lst
-cat empty.lst
-test 0 = `wc -l < empty.lst`
+test -s empty.lst && { cat empty.lst; Exit 1; }
 
 $MAKE clean
 test ! -f libtop.la
@@ -148,9 +149,10 @@ test -f installcheck-ok
 rm -f installcheck-ok
 
 $MAKE uninstall
-find lib -type f -print > lib.lst
-test 0 = `wc -l < lib.lst`
-find bin -type f -print > bin.lst
-test 0 = `wc -l < bin.lst`
+for d in lib bin; do
+  find $d -type f -print > $d.lst
+  test -s $d.lst && { cat $d.lst; Exit 1; }
+  : For shells with busted 'set -e'.
+done
 
 :
diff --git a/t/ltinit.sh b/t/ltinit.sh
index 49ddbe0..e0f9b02 100755
--- a/t/ltinit.sh
+++ b/t/ltinit.sh
@@ -55,8 +55,7 @@ libtoolize
 $EGREP 'LT_(INIT|PREREQ)' configure && Exit 1 # Sanity check.
 $AUTOMAKE -a
 
-cwd=`pwd`
-./configure --prefix="$cwd/inst" >stdout || { cat stdout; Exit 1; }
+./configure --prefix="$(pwd)/inst" >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep '^checking.*dlfcn\.h.* no$' stdout || grep '^checking.*dlopen' stdout
 
diff --git a/t/ltorder.sh b/t/ltorder.sh
index 358e620..59047a0 100755
--- a/t/ltorder.sh
+++ b/t/ltorder.sh
@@ -49,7 +49,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-./configure "--prefix=`pwd`/inst"
+./configure --prefix="$(pwd)/inst"
 
 $MAKE
 $MAKE install 2>stderr || { cat stderr >&2; Exit 1; }
@@ -57,6 +57,6 @@ cat stderr >&2
 grep 'has not been installed' stderr && Exit 1
 
 $MAKE uninstall
-test `find inst -type f -print | wc -l` -eq 0
+test $(find inst -type f -print | wc -l) -eq 0
 
 :
diff --git a/t/maintmode-configure-msg.sh b/t/maintmode-configure-msg.sh
index 8a7c451..5396cbf 100755
--- a/t/maintmode-configure-msg.sh
+++ b/t/maintmode-configure-msg.sh
@@ -37,8 +37,7 @@ check_configure_message_with ()
   ./configure ${1+"$@"} >stdout || { cat stdout; Exit 1; }
   cat stdout
   grep "^checking whether to enable maintainer-specific.*\\.\\.\\. $answer$" 
stdout
-  test `grep -c 'checking.*maint' stdout` -eq 1
-  :
+  test $(grep -c 'checking.*maint' stdout) -eq 1
 }
 
 set_maintmode "DEFAULT"
diff --git a/t/make-dryrun.tap b/t/make-dryrun.tap
index 2172124..8e25d88 100755
--- a/t/make-dryrun.tap
+++ b/t/make-dryrun.tap
@@ -53,7 +53,7 @@ $AUTOMAKE   || fatal_ "automake failed"
 check_no_dryrun ()
 {
   command_ok_ "dry-run ($cnt)" $MAKE notdry ${1+"$@"}
-  cnt=`expr $cnt + 1`
+  cnt=$(($cnt + 1))
 }
 cnt=1
 
@@ -86,7 +86,7 @@ check_dryrun ()
   fi
   result_ "$r" -D "$directive" -r "$reason" "not dry-run ($cnt)"
   unset r directive reason
-  cnt=`expr $cnt + 1`
+  cnt=$(($cnt + 1))
 }
 cnt=1
 
@@ -108,7 +108,7 @@ check_metachars ()
   fi
   result_ "$r" "dry-run, with shell metachars ($cnt)"
   unset r
-  cnt=`expr $cnt + 1`
+  cnt=$(($cnt + 1))
 }
 cnt=1
 
diff --git a/t/makej2.sh b/t/makej2.sh
index 8183887..2e5d55b 100755
--- a/t/makej2.sh
+++ b/t/makej2.sh
@@ -35,10 +35,10 @@ $AUTOMAKE
 
 mkdir build
 cd build
-../configure "--prefix=`pwd`/inst"
+../configure --prefix="$(pwd)/inst"
 
 $MAKE -j2 || skip_ "$MAKE failed to run with two parallel jobs"
 $MAKE -j2 distcheck
 $MAKE test-distdir-removed
 
-Exit 0
+:
diff --git a/t/maken.sh b/t/maken.sh
index bb64444..1257e4a 100755
--- a/t/maken.sh
+++ b/t/maken.sh
@@ -47,7 +47,6 @@ $AUTOCONF
 $AUTOMAKE
 ./configure
 
-$sleep
 echo stamp > stampfile
 $sleep
 for target in dist distcheck; do
@@ -56,7 +55,8 @@ for target in dist distcheck; do
     $MAKE -n $target | grep stamp-sub-dist-hook || Exit 1
   fi
   $MAKE test-no-distdir
-  test `ls -1t | sed 1q` = stampfile
+  # No file has been actually touched or created.
+  is_newest stampfile $(find .)
 done
 
-Exit 0
+:
diff --git a/t/man2.sh b/t/man2.sh
index 38c3992..7a1c5d7 100755
--- a/t/man2.sh
+++ b/t/man2.sh
@@ -36,15 +36,17 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
+cwd=$(pwd) || fatal_ "getting current working directory"
+
 # Let's play with $DESTDIR too, it shouldn't hurt.
 ./configure --prefix='' --mandir=/man
-$MAKE DESTDIR="`pwd`/_inst" install
+$MAKE DESTDIR="$cwd/_inst" install
 
 test -f ./_inst/man/man2/foo.2
 test -f ./_inst/man/man4/foo.4
 test -f ./_inst/man/man4/bar.4
 
-$MAKE DESTDIR="`pwd`/_inst" uninstall
+$MAKE DESTDIR="$cwd/_inst" uninstall
 
 test ! -f ./_inst/man/man2/foo.2
 test ! -f ./_inst/man/man4/foo.4
diff --git a/t/man4.sh b/t/man4.sh
index c7333b9..c8fd86d 100755
--- a/t/man4.sh
+++ b/t/man4.sh
@@ -67,7 +67,7 @@ cat > bin/help2man <<'END'
 exit 127
 END
 chmod +x bin/help2man
-PATH=`pwd`/bin$PATH_SEPARATOR$PATH
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH
 
 grep_error_messages()
 {
diff --git a/t/man5.sh b/t/man5.sh
index 674ea03..89f2545 100755
--- a/t/man5.sh
+++ b/t/man5.sh
@@ -40,28 +40,30 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
+cwd=$(pwd) || fatal_ "getting current working directory"
+
 # Let's play with $DESTDIR too, it shouldn't hurt.
 ./configure --mandir=/man
-$MAKE DESTDIR="`pwd`/_inst" install
+$MAKE DESTDIR="$cwd/_inst" install
 
-test -f ./_inst/man/man2/foo.2
-test -f ./_inst/man/man2/nfoo.2
-test -f ./_inst/man/man2/baz-1.4.2
-test -f ./_inst/man/man2/nbaz-1.4.2
-test -f ./_inst/man/man3/bar.3
-test -f ./_inst/man/man3/nbar.3
+test -f _inst/man/man2/foo.2
+test -f _inst/man/man2/nfoo.2
+test -f _inst/man/man2/baz-1.4.2
+test -f _inst/man/man2/nbaz-1.4.2
+test -f _inst/man/man3/bar.3
+test -f _inst/man/man3/nbar.3
 
-test ! -d ./_inst/man/man1
-test ! -d ./_inst/man/man4
-test ! -d ./_inst/man/man5
+test ! -d _inst/man/man1
+test ! -d _inst/man/man4
+test ! -d _inst/man/man5
 
-$MAKE DESTDIR="`pwd`/_inst" uninstall
+$MAKE DESTDIR="$cwd/_inst" uninstall
 
-test ! -f ./_inst/man/man2/foo.2
-test ! -f ./_inst/man/man2/nfoo.2
-test ! -f ./_inst/man/man2/baz-1.4.2
-test ! -f ./_inst/man/man2/nbaz-1.4.2
-test ! -f ./_inst/man/man3/bar.3
-test ! -f ./_inst/man/man3/nbar.3
+test ! -f _inst/man/man2/foo.2
+test ! -f _inst/man/man2/nfoo.2
+test ! -f _inst/man/man2/baz-1.4.2
+test ! -f _inst/man/man2/nbaz-1.4.2
+test ! -f _inst/man/man3/bar.3
+test ! -f _inst/man/man3/nbar.3
 
 :
diff --git a/t/mdate5.sh b/t/mdate5.sh
index 4cef952..66afac1 100755
--- a/t/mdate5.sh
+++ b/t/mdate5.sh
@@ -21,7 +21,7 @@ am_create_testdir=empty
 
 get_shell_script mdate-sh
 
-set x `./mdate-sh mdate-sh`
+set x $(./mdate-sh mdate-sh)
 shift
 echo "$*" # For debugging.
 
@@ -38,7 +38,7 @@ case $2 in
 esac
 
 # Stricter checks on the year required a POSIX date(1) command.
-if year=`date +%Y` && test $year -gt 2010; then
+if year=$(date +%Y) && test $year -gt 2010; then
   test $year = $3 || Exit 1
 fi
 
diff --git a/t/missing5.sh b/t/missing5.sh
index 80bba36..363cc1a 100755
--- a/t/missing5.sh
+++ b/t/missing5.sh
@@ -24,7 +24,7 @@ get_shell_script missing
 
 # These programs may be invoked by 'missing'.
 needed_tools='chmod find sed test touch'
-needed_tools_csep=`echo $needed_tools | sed 's/ /, /g'`
+needed_tools_csep=$(echo $needed_tools | sed 's/ /, /g')
 
 cat >configure.ac <<EOF
 AC_INIT([missing4], [1.0])
diff --git a/t/mkinst2.sh b/t/mkinst2.sh
index 6582836..2a4fb0b 100755
--- a/t/mkinst2.sh
+++ b/t/mkinst2.sh
@@ -30,7 +30,11 @@ END
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
-./configure --prefix "`pwd`/sub"
+./configure --prefix "$(pwd)/sub"
 
 $MAKE installdirs
 test ! -d sub/man
+$MAKE install
+test ! -d sub/man
+
+:
diff --git a/t/mkinst3.sh b/t/mkinst3.sh
index fbe01c6..08cfb76 100755
--- a/t/mkinst3.sh
+++ b/t/mkinst3.sh
@@ -19,6 +19,8 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
+cwd=$(pwd) || fatal_ "getting current working directory"
+
 # Make sure the directory we will create can be created...
 mkdir '~a b' && mkdir '~a b/-x  y' \
   || skip_ "directory names with spaces and metacharacters not accepted"
@@ -49,10 +51,9 @@ exec mkdir "$@"
 EOF
 
 chmod +x bin/mkdir
-AM_PATH=$PATH
-export AM_PATH
-PATH=`pwd`/bin$PATH_SEPARATOR$PATH
-export PATH
+
+AM_PATH=$PATH; export AM_PATH
+PATH=$cwd/bin$PATH_SEPARATOR$PATH; export PATH
 
 # Test mkinstalldirs without mkdir -p.
 
@@ -60,6 +61,8 @@ export PATH
 test -d '~a b/-x  y'
 rm -rf '~a b'
 
-./mkinstalldirs "`pwd`///~a b//-x  y"
-test -d "`pwd`/~a b/-x  y"
+./mkinstalldirs "$cwd///~a b//-x  y"
+test -d "$cwd/~a b/-x  y"
 rm -rf '~a b'
+
+:
diff --git a/t/mmodely.sh b/t/mmodely.sh
index 6c61915..25139aa 100755
--- a/t/mmodely.sh
+++ b/t/mmodely.sh
@@ -81,7 +81,7 @@ cat >mylex.sh <<'END'
 echo "$@" >lex.yy.c
 END
 chmod +x myyacc.sh mylex.sh
-PATH="`pwd`$PATH_SEPARATOR$PATH"
+PATH=$(pwd)$PATH_SEPARATOR$PATH; export PATH
 
 # "make maintainer-clean; ./configure; make" should always work,
 # per GNU Standard.
@@ -89,5 +89,7 @@ $MAKE maintainer-clean
 ./configure
 YACC="myyacc.sh" LEX="mylex.sh" \
    LEX_OUTPUT_ROOT='lex.yy' $MAKE -e zardoz.c joe.c
-grep zardoz.y zardoz.c
-grep joe.l joe.c
+$FGREP zardoz.y zardoz.c
+$FGREP joe.l joe.c
+
+:
diff --git a/t/multlib.sh b/t/multlib.sh
index 0295ccc..698f1c0 100755
--- a/t/multlib.sh
+++ b/t/multlib.sh
@@ -27,7 +27,7 @@ mkdir m4
 cp "$mldir"/config-ml.in "$mldir"/symlink-tree .
 cp "$mldir"/multi.m4 m4
 
-ACLOCAL_PATH=${ACLOCAL_PATH+"$ACLOCAL_PATH:"}`pwd`/m4
+ACLOCAL_PATH=${ACLOCAL_PATH+"$ACLOCAL_PATH:"}$(pwd)/m4
 export ACLOCAL_PATH
 
 cat >configure.ac <<'END'
@@ -53,7 +53,7 @@ gcc ${1+"$@"}
 END
 
 chmod +x mycc
-PATH=`pwd`$PATH_SEPARATOR$PATH
+PATH=$(pwd)$PATH_SEPARATOR$PATH; export PATH
 
 cat >Makefile.am <<'EOF'
 SUBDIRS = @subdirs@
diff --git a/t/nobase-libtool.sh b/t/nobase-libtool.sh
index 38008cd..163ffd3 100755
--- a/t/nobase-libtool.sh
+++ b/t/nobase-libtool.sh
@@ -54,8 +54,7 @@ EOF
 mkdir sub
 
 cat >source.c <<'EOF'
-int
-main (int argc, char *argv[])
+int main (int argc, char *argv[])
 {
   return 0;
 }
@@ -68,14 +67,14 @@ libtoolize
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a --copy
-./configure --prefix "`pwd`/inst" --program-prefix=p
+./configure --prefix "$(pwd)/inst" --program-prefix=p
 
 $MAKE
 $MAKE test-install-data
 $MAKE test-install-exec
 $MAKE uninstall
 
-test `find inst/foo -type f -print | wc -l` = 0
+test $(find inst/foo -type f -print | wc -l) -eq 0
 
 $MAKE install-strip
 
@@ -85,11 +84,11 @@ $MAKE uninstall
 $MAKE distclean
 mkdir build
 cd build
-../configure --prefix "`pwd`/inst" --program-prefix=p
+../configure --prefix "$(pwd)/inst" --program-prefix=p
 $MAKE
 $MAKE test-install-data
 $MAKE test-install-exec
 $MAKE uninstall
-test `find inst/foo -type f -print | wc -l` = 0
+test $(find inst/foo -type f -print | wc -l) -eq 0
 
 :
diff --git a/t/nobase-python.sh b/t/nobase-python.sh
index 2850901..d086bbe 100755
--- a/t/nobase-python.sh
+++ b/t/nobase-python.sh
@@ -45,8 +45,7 @@ END
 
 mkdir sub
 
-for file in one.py sub/base.py two.py sub/nobase.py
-do
+for file in one.py sub/base.py two.py sub/nobase.py; do
   echo 'def one(): return 1' >$file
 done
 
@@ -54,7 +53,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-./configure --prefix "`pwd`/inst" --program-prefix=p
+./configure --prefix "$(pwd)/inst" --program-prefix=p
 
 $MAKE
 $MAKE test-install-data
@@ -70,7 +69,7 @@ $MAKE uninstall
 $MAKE distclean
 mkdir build
 cd build
-../configure --prefix "`pwd`/inst" --program-prefix=p
+../configure --prefix "$(pwd)/inst" --program-prefix=p
 $MAKE
 $MAKE test-install-data
 $MAKE uninstall
diff --git a/t/nobase.sh b/t/nobase.sh
index e7661c0..a7219ed 100755
--- a/t/nobase.sh
+++ b/t/nobase.sh
@@ -120,14 +120,14 @@ rm -f install-sh
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a --copy
-./configure --prefix "`pwd`/inst" --program-prefix=p
+./configure --prefix "$(pwd)/inst" --program-prefix=p
 
 $MAKE
 $MAKE test-install-data
 $MAKE test-install-exec
 $MAKE uninstall
 
-test `find inst/foo -type f -print | wc -l` = 0
+test $(find inst/foo -type f -print | wc -l) -eq 0
 
 $MAKE install-strip
 
@@ -137,11 +137,11 @@ $MAKE uninstall
 $MAKE distclean
 mkdir build
 cd build
-../configure --prefix "`pwd`/inst" --program-prefix=p
+../configure --prefix "$(pwd)/inst" --program-prefix=p
 $MAKE
 $MAKE test-install-data
 $MAKE test-install-exec
 $MAKE uninstall
-test `find inst/foo -type f -print | wc -l` = 0
+test $(find inst/foo -type f -print | wc -l) -eq 0
 
 :
diff --git a/t/nodist2.sh b/t/nodist2.sh
index 36851be..9c7ec30 100755
--- a/t/nodist2.sh
+++ b/t/nodist2.sh
@@ -32,7 +32,7 @@ EOF
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
-./configure --prefix "`pwd`/install"
+./configure --prefix "$(pwd)/install"
 $MAKE install-data
 
 :
diff --git a/t/notrans.sh b/t/notrans.sh
index 487b66f..81ed4d8 100755
--- a/t/notrans.sh
+++ b/t/notrans.sh
@@ -79,8 +79,8 @@ test-install: install
        test -f inst/man/man2/z-bar2.2
        test -f inst/man/man1/z-baz.1
        test -f inst/man/man1/z-baz2.1
-       if test -d inst/man/man8; then (exit 1); else :; fi
-       if test -d inst/man/man9; then (exit 1); else :; fi
+       test ! -d inst/man/man8
+       test ! -d inst/man/man9
 EOF
 
 : > foo.1
@@ -106,16 +106,18 @@ grep '^install-man3:' Makefile.in | grep 
'\$(nodist_man_MANS)'
 grep '^install-man4:' Makefile.in | grep '\$(notrans_man_MANS)'
 grep '^install-man5:' Makefile.in | grep '\$(notrans_dist_man_MANS)'
 grep '^install-man6:' Makefile.in | grep '\$(notrans_nodist_man_MANS)'
+grep '^install-man8:' Makefile.in && Exit 1
+grep '^install-man9:' Makefile.in && Exit 1
 
-if grep '^install-man8:' Makefile.in; then Exit 1; else :; fi
-if grep '^install-man9:' Makefile.in; then Exit 1; else :; fi
+cwd=$(pwd) || fatal_ "getting current working directory"
 
-./configure --program-prefix=gnu- --prefix "`pwd`"/inst --mandir 
"`pwd`"/inst/man
+./configure --program-prefix=gnu- --prefix "$cwd"/inst \
+                                  --mandir "$cwd"/inst/man
 $MAKE
 $MAKE test-install
-test `find inst/man -type f -print | wc -l` = 24
+test $(find inst/man -type f -print | wc -l) -eq 24
 $MAKE uninstall
-test `find inst/man -type f -print | wc -l` = 0
+test $(find inst/man -type f -print | wc -l) -eq 0
 
 # Opportunistically test for installdirs.
 rm -rf inst
@@ -127,5 +129,7 @@ test -d inst/man/man4
 test -d inst/man/man5
 test -d inst/man/man6
 test -d inst/man/man7
-if test -d inst/man/man8; then Exit 1; else :; fi
-if test -d inst/man/man9; then Exit 1; else :; fi
+test -d inst/man/man8 && Exit 1
+test -d inst/man/man9 && Exit 1
+
+:
diff --git a/t/number.sh b/t/number.sh
index b96e118..d5c3acf 100755
--- a/t/number.sh
+++ b/t/number.sh
@@ -14,7 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure _OBJECTS only generated once.  Bug reported by
+# Test to make sure _OBJECTS is only generated once.  Bug reported by
 # Joerg-Martin Schwarz.
 
 . ./defs || Exit 1
@@ -31,7 +31,6 @@ $ACLOCAL
 $AUTOMAKE
 
 grep '^zardoz_OBJECTS' Makefile.in
-count=`grep -c '^zardoz_OBJECTS' Makefile.in`
-test $count -eq 1
+test $(grep -c '^zardoz_OBJECTS' Makefile.in) -eq 1
 
 :
diff --git a/t/objc-megademo.sh b/t/objc-megademo.sh
index b0d2887..459fb0d 100755
--- a/t/objc-megademo.sh
+++ b/t/objc-megademo.sh
@@ -322,7 +322,7 @@ END
 ./configure
 $MAKE
 
-if cross_compiling; then :; else
+if ! cross_compiling; then
   unindent > exp << 'END'
     [Hello C, world C]
     [Hello C++, world C++]
diff --git a/t/objext-pr10128.sh b/t/objext-pr10128.sh
index 2fe2dfd..440fc1d 100755
--- a/t/objext-pr10128.sh
+++ b/t/objext-pr10128.sh
@@ -52,7 +52,7 @@ touch foo.lisp mu1.lisp mu2.lisp
 $MAKE all
 cat foo
 cat zardoz
-test "`cat foo`"    = "Linked foo from foo.fasl"
-test "`cat zardoz`" = "Linked zardoz from mu1.fasl mu2.fasl"
+test "$(cat foo)"    = "Linked foo from foo.fasl"
+test "$(cat zardoz)" = "Linked zardoz from mu1.fasl mu2.fasl"
 
 :
diff --git a/t/oldvars.sh b/t/oldvars.sh
index 87d9cf1..dd162ff 100755
--- a/t/oldvars.sh
+++ b/t/oldvars.sh
@@ -32,4 +32,6 @@ EOF
 
 $ACLOCAL
 AUTOMAKE_fails
-test `grep -c anachronism stderr` -eq 8
+test $(grep -c anachronism stderr) -eq 8
+
+:
diff --git a/t/output8.sh b/t/output8.sh
index 1339c67..943e758 100755
--- a/t/output8.sh
+++ b/t/output8.sh
@@ -42,11 +42,13 @@ $AUTOMAKE --add-missing
 
 ./configure
 $MAKE
-test "`cat a/foo.sh`" = foo
+test "$(cat a/foo.sh)" = foo
 
 $sleep
 echo 'bar' >a/foo.sh.in
 
 cd a
 $MAKE foo.sh
-test "`cat foo.sh`" = bar
+test "$(cat foo.sh)" = bar
+
+:
diff --git a/t/override-conditional-1.sh b/t/override-conditional-1.sh
index 1f66d3f..020a6e3 100755
--- a/t/override-conditional-1.sh
+++ b/t/override-conditional-1.sh
@@ -36,7 +36,7 @@ $ACLOCAL
 $AUTOMAKE -Wno-override
 
 # "ps:" should be output in two conditions
-test `grep '[^-]ps:' Makefile.in | wc -l` = 2
+test $(grep -c '[^-]ps:' Makefile.in) -eq 2
 grep '@address@hidden: *foobar' Makefile.in
 grep '@address@hidden: *ps-am' Makefile.in
 
diff --git a/t/override-html.sh b/t/override-html.sh
index 6438c99..cf57880 100755
--- a/t/override-html.sh
+++ b/t/override-html.sh
@@ -28,6 +28,6 @@ $ACLOCAL
 $AUTOMAKE -Wno-override
 
 # Overriding 'html' should cause only one "html:" rule to be output.
-test `grep '^html:' Makefile.in | wc -l` = 1
+test $(grep -c '^html:' Makefile.in) -eq 1
 
 :
diff --git a/t/parallel-am.sh b/t/parallel-am.sh
index db184b2..a27c663 100755
--- a/t/parallel-am.sh
+++ b/t/parallel-am.sh
@@ -83,7 +83,7 @@ $ACLOCAL
 unset AUTOMAKE_JOBS || :
 AUTOMAKE_run --add-missing
 mv stderr expected
-Makefile_ins=`find . -name Makefile.in`
+Makefile_ins=$(find . -name Makefile.in)
 for file in $Makefile_ins; do
   mv $file $file.exp
 done
diff --git a/t/parallel-tests-exit-statuses.sh 
b/t/parallel-tests-exit-statuses.sh
index 90583d5..8d8e6a9 100755
--- a/t/parallel-tests-exit-statuses.sh
+++ b/t/parallel-tests-exit-statuses.sh
@@ -25,15 +25,15 @@ END
 
 # $failure_statuses should be defined to the list of all integers between
 # 1 and 255 (inclusive), excluded 77 and 99.
-failure_statuses=`seq_ 1 255 | $EGREP -v '^(77|99)$' | tr "$nl" ' '`
+failure_statuses=$(seq_ 1 255 | $EGREP -v '^(77|99)$' | tr "$nl" ' ')
 # For debugging.
 echo "failure_statuses: $failure_statuses"
 # Sanity check.
-test `for st in $failure_statuses; do echo $st; done | wc -l` -eq 253 \
+test $(for st in $failure_statuses; do echo $st; done | wc -l) -eq 253 \
   || fatal_ "initializing list of exit statuses for simple failures"
 
 cat > Makefile.am <<END
-LOG_COMPILER = ./do-exit
+LOG_COMPILER = $AM_TEST_RUNNER_SHELL ./do-exit
 fail_tests = $failure_statuses
 TESTS = 0 77 99 $failure_statuses
 \$(TESTS):
@@ -44,7 +44,7 @@ cat > do-exit <<'END'
 echo "$0: $1"
 case $1 in
   [0-9]|[0-9][0-9]|[0-9][0-9][0-9]) st=$1;;
-  */[0-9]|*/[0-9][0-9]|*/[0-9][0-9][0-9]) st=`echo x"$1" | sed 's|.*/||'`;;
+  */[0-9]|*/[0-9][0-9]|*/[0-9][0-9][0-9]) st=${1##*/};;
   *) st=99;;
 esac
 exit $st
diff --git a/t/parallel-tests-interrupt.tap b/t/parallel-tests-interrupt.tap
index 08f9031..04ad214 100755
--- a/t/parallel-tests-interrupt.tap
+++ b/t/parallel-tests-interrupt.tap
@@ -30,7 +30,7 @@ END
 cat > Makefile.am << 'END'
 TESTS = foo.test
 ## Provide more debugging info.
-TEST_LOG_COMPILER = $(SHELL) -x
+TEST_LOG_COMPILER = $(SHELL) -ex
 ## Required by foo.test; see below.
 AM_TESTS_FD_REDIRECT = 9>&1
 END
diff --git a/t/parallel-tests-log-compiler-1.sh 
b/t/parallel-tests-log-compiler-1.sh
index 1f16d9f..10519e0 100755
--- a/t/parallel-tests-log-compiler-1.sh
+++ b/t/parallel-tests-log-compiler-1.sh
@@ -69,7 +69,7 @@ END
 sed 's/--chk/--am-test/' chk-compiler > test-compiler
 
 mkdir bin
-PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
 
 cat > bin/t-compiler <<'END'
 #! /bin/sh
diff --git a/t/parallel-tests-many.sh b/t/parallel-tests-many.sh
index d4f6c7f..b2c1f76 100755
--- a/t/parallel-tests-many.sh
+++ b/t/parallel-tests-many.sh
@@ -116,7 +116,7 @@ setup_data ()
 
 for count in 1 2 4 8 12 16 20 24 28 32 48 64 96 128 E_HUGE; do
   test $count = E_HUGE && break
-  count=`expr $count '*' 100` || Exit 99
+  count=$(($count * 100))
   setup_data
   if $MAKE this-will-fail; then
     continue
@@ -125,7 +125,8 @@ for count in 1 2 4 8 12 16 20 24 28 32 48 64 96 128 E_HUGE; 
do
     # hit the system command-line limits; we can stop.  But first, for
     # good measure, increase the number of tests of some 20%, to be
     # "even more sure" of really tickling command line length limits.
-    count=`expr '(' $count '*' 12 ')' / 10` || Exit 99
+    count=$(($count * 12))
+    count=$(($count / 10))
     setup_data
     break
   fi
@@ -159,15 +160,15 @@ ls -1 $deepdir | grep '\.log$' > lst
 sed 20q lst # For debugging.
 sed 20q grp # Likewise.
 
-test `cat <grp | wc -l` -eq $count
-test `cat <lst | wc -l` -eq $count
+test $(cat <grp | wc -l) -eq $count
+test $(cat <lst | wc -l) -eq $count
 
 # We need to simulate a failure of two tests.
 st=0
 env TESTS="$deepdir/$tname-1.test $deepdir/$tname-2.test" \
     TEST_LOG_COMPILER=false $MAKE -e check > stdout && st=1
 cat stdout
-test `grep -c '^FAIL:' stdout` -eq 2 || st=1
+test $(grep -c '^FAIL:' stdout) -eq 2 || st=1
 test $st -eq 0 || fatal_ "couldn't simulate failure of two tests"
 unset st
 
@@ -175,7 +176,7 @@ $MAKE recheck > stdout || { cat stdout; Exit 1; }
 cat stdout
 grep "^PASS: .*$tname-1\.test" stdout
 grep "^PASS: .*$tname-2\.test" stdout
-test `LC_ALL=C grep -c "^[A-Z][A-Z]*:" stdout` -eq 2
+test $(LC_ALL=C grep -c "^[A-Z][A-Z]*:" stdout) -eq 2
 grep "^# TOTAL: 2$" stdout
 grep "^# PASS:  2$" stdout
 
diff --git a/t/parallel-tests-trailing-bslash.sh 
b/t/parallel-tests-trailing-bslash.sh
index 1291764..e6fd2ad 100755
--- a/t/parallel-tests-trailing-bslash.sh
+++ b/t/parallel-tests-trailing-bslash.sh
@@ -94,7 +94,7 @@ chmod a+x my-shell
 
 cat my-shell
 
-CONFIG_SHELL=`pwd`/my-shell; export CONFIG_SHELL
+CONFIG_SHELL=$(pwd)/my-shell; export CONFIG_SHELL
 
 $ACLOCAL
 $AUTOCONF
diff --git a/t/parallel-tests.sh b/t/parallel-tests.sh
index 459a24d..b152fc5 100755
--- a/t/parallel-tests.sh
+++ b/t/parallel-tests.sh
@@ -69,8 +69,8 @@ cat stdout
 count_test_results total=3 pass=1 fail=1 skip=0 xfail=0 xpass=0 error=1
 test -f test-suite.log
 cat test-suite.log
-test `grep -c '^FAIL:' test-suite.log` -eq 1
-test `grep -c '^ERROR:' test-suite.log` -eq 1
+test $(grep -c '^FAIL:' test-suite.log) -eq 1
+test $(grep -c '^ERROR:' test-suite.log) -eq 1
 $EGREP '^(X?PASS|XFAIL|SKIP)' test-suite.log && Exit 1
 test -f baz.log
 test -f bar.log
diff --git a/t/parallel-tests2.sh b/t/parallel-tests2.sh
index d54b9e8..a793dec 100755
--- a/t/parallel-tests2.sh
+++ b/t/parallel-tests2.sh
@@ -26,10 +26,8 @@
 while :; do
   for r2h in $RST2HTML rst2html rst2html.py; do
     echo "$me: running $r2h --version"
-    # Don't use "&&" here, or a bug of 'set -e' present in some
-    # versions of the BSD shell will be triggered.  We add the
-    # dummy "else" branch for extra safety.
-    if $r2h --version; then break 2; else :; fi
+    $r2h --version && break 2
+    : For shells with busted 'set -e'.
   done
   skip_all_ "no proper rst2html program found"
 done
diff --git a/t/parallel-tests3.sh b/t/parallel-tests3.sh
index 8e3be0e..6a6a998 100755
--- a/t/parallel-tests3.sh
+++ b/t/parallel-tests3.sh
@@ -98,7 +98,7 @@ cd ..
 # still be ongoing when the parallel one has terminated.
 kill -0 $!
 cat parallel/stdout
-test `grep -c '^PASS:' parallel/stdout` -eq 12
+test $(grep -c '^PASS:' parallel/stdout) -eq 12
 
 # Wait long enough so that there are no open files any more when the
 # post-test cleanup runs.  But exit after we've waited for two minutes
@@ -106,7 +106,7 @@ test `grep -c '^PASS:' parallel/stdout` -eq 12
 # already happened).
 i=1
 while test ! -f serial/test-suite.log && test $i -le 120; do
-  i=`expr $i + 1`
+  i=$(($i + 1))
   sleep '1' # Extra quoting to please maintainer-check.
 done
 $sleep
diff --git a/t/phony.sh b/t/phony.sh
index a818cfb..7ee1116 100755
--- a/t/phony.sh
+++ b/t/phony.sh
@@ -26,4 +26,6 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
-test `$FGREP .PHONY: Makefile.in | wc -l` = 3
+test $($FGREP -c '.PHONY:' Makefile.in) -eq 3
+
+:
diff --git a/t/pluseq5.sh b/t/pluseq5.sh
index 5db9c47..b8b18a5 100755
--- a/t/pluseq5.sh
+++ b/t/pluseq5.sh
@@ -43,7 +43,7 @@ AUTOMAKE_fails
 # Is !CHECK mentioned?
 grep ':.*!CHECK$' stderr
 # Is there only one missing condition?
-test `grep ':  ' stderr | wc -l` = 1
+test $(grep -c ':  ' stderr) -eq 1
 
 # By the way, Automake should suggest using AM_CPPFLAGS,
 # because INCLUDES is an obsolete name.
diff --git a/t/pluseq6.sh b/t/pluseq6.sh
index 7a8f187..2b65e1a 100755
--- a/t/pluseq6.sh
+++ b/t/pluseq6.sh
@@ -30,9 +30,9 @@ END
 
 $ACLOCAL
 $AUTOMAKE
-$FGREP '@mandir@ foo' Makefile.in
 
-num=`grep '^mandir =' Makefile.in | wc -l`
-test $num -eq 1
+$FGREP 'mandir' Makefile.in # For debugging.
+$FGREP '@mandir@ foo' Makefile.in
+test $(grep -c '^mandir =' Makefile.in) -eq 1
 
 :
diff --git a/t/pluseq7.sh b/t/pluseq7.sh
index 7f5a32e..e6e299c 100755
--- a/t/pluseq7.sh
+++ b/t/pluseq7.sh
@@ -32,7 +32,6 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails -Wno-portability
-q="[\`'\"]"
-grep "^Makefile\.am:3:.* AR .* with $q=$q before .*$q+=$q" stderr
+grep "^Makefile\.am:3:.* AR .* with '=' before .*'+='" stderr
 
 :
diff --git a/t/pluseq9.sh b/t/pluseq9.sh
index f3c8021..981a868 100755
--- a/t/pluseq9.sh
+++ b/t/pluseq9.sh
@@ -66,6 +66,6 @@ AUTOMAKE_fails
 grep '[cC]annot apply.*+=' stderr
 grep ':   !COND1 and !COND3$' stderr
 # Make sure there is exactly one missing condition.
-test `grep ':  ' stderr | wc -l` = 1
+test $(grep -c ':  ' stderr) -eq 1
 
 :
diff --git a/t/posixsubst-data.sh b/t/posixsubst-data.sh
index c2c2d7e..82be4e6 100755
--- a/t/posixsubst-data.sh
+++ b/t/posixsubst-data.sh
@@ -62,7 +62,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-cwd=`pwd` || Exit 1
+cwd=$(pwd) || fatal_ "getting current working directory"
 ./configure --prefix="$cwd/_inst"
 $MAKE install
 test -f bar.data
diff --git a/t/posixsubst-libraries.sh b/t/posixsubst-libraries.sh
index f437571..f3e89a7 100755
--- a/t/posixsubst-libraries.sh
+++ b/t/posixsubst-libraries.sh
@@ -54,7 +54,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-cwd=`pwd` || Exit 1
+cwd=$(pwd) || fatal_ "getting current working directory"
 ./configure --prefix="$cwd/_inst"
 $MAKE
 test -f libfoo2.c
diff --git a/t/posixsubst-ltlibraries.sh b/t/posixsubst-ltlibraries.sh
index b4b2a92..5495814 100755
--- a/t/posixsubst-ltlibraries.sh
+++ b/t/posixsubst-ltlibraries.sh
@@ -55,7 +55,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-cwd=`pwd` || Exit 1
+cwd=$(pwd) || fatal_ "getting current working directory"
 ./configure --prefix="$cwd/_inst"
 $MAKE
 test -f libfoo2.c
diff --git a/t/posixsubst-programs.sh b/t/posixsubst-programs.sh
index a02cb92..99642c2 100755
--- a/t/posixsubst-programs.sh
+++ b/t/posixsubst-programs.sh
@@ -53,7 +53,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-cwd=`pwd` || Exit 1
+cwd=$(pwd) || fatal_ "getting current working directory"
 ./configure --prefix="$cwd/_inst"
 $MAKE
 $MAKE install
diff --git a/t/posixsubst-scripts.sh b/t/posixsubst-scripts.sh
index cda515f..79c95e2 100755
--- a/t/posixsubst-scripts.sh
+++ b/t/posixsubst-scripts.sh
@@ -88,7 +88,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-cwd=`pwd` || Exit 1
+cwd=$(pwd) || fatal_ "getting current working directory"
 ./configure --prefix="$cwd/_inst"
 $MAKE
 $MAKE test1 test2
diff --git a/t/pr287.sh b/t/pr287.sh
index 681f6d6..1cd26ae 100755
--- a/t/pr287.sh
+++ b/t/pr287.sh
@@ -31,7 +31,6 @@ cat > foo << 'END'
 #! /bin/sh
 echo Maude
 END
-
 chmod +x foo
 
 mkdir install
@@ -40,7 +39,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-./configure "--prefix=`cd install && pwd`"
+./configure "--prefix=$(cd install && pwd)"
 
 $MAKE
 $MAKE distdir
diff --git a/t/pr300-lib.sh b/t/pr300-lib.sh
index b655cf0..a676a3a 100755
--- a/t/pr300-lib.sh
+++ b/t/pr300-lib.sh
@@ -50,7 +50,7 @@ $AUTOMAKE --copy --add-missing
 # or distributions possibly overriding '${libdir}' in their $CONFIG_SITE
 # file (for example, defining it to '${prefix}/lib64' on 64-bit systems,
 # as is the case with openSUSE 12.1).  See automake bug#10426.
-cwd=`pwd` || Exit 99
+cwd=$(pwd) || fatal_ "getting current working directory"
 ./configure --prefix "$cwd/inst" --libdir "$cwd/inst/lib"
 
 $MAKE
diff --git a/t/pr300-ltlib.sh b/t/pr300-ltlib.sh
index 8db6b07..1495b0b 100755
--- a/t/pr300-ltlib.sh
+++ b/t/pr300-ltlib.sh
@@ -48,7 +48,7 @@ $AUTOMAKE --copy --add-missing
 # or distributions possibly overriding '${libdir}' in their $CONFIG_SITE
 # file (for example, defining it to '${prefix}/lib64' on 64-bit systems,
 # as is the case with openSUSE 12.1).  See automake bug#10426.
-cwd=`pwd` || Exit 99
+cwd=$(pwd) || fatal_ "getting current working directory"
 ./configure --prefix "$cwd/inst" --libdir "$cwd/inst/lib"
 
 # A rule in the Makefile should create subdir.
diff --git a/t/pr300-prog.sh b/t/pr300-prog.sh
index 6812231..7be0911 100755
--- a/t/pr300-prog.sh
+++ b/t/pr300-prog.sh
@@ -62,7 +62,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --copy --add-missing
 
-./configure --prefix "`pwd`/inst"
+./configure --prefix "$(pwd)/inst"
 
 $MAKE test-all
 $MAKE test-install
diff --git a/t/pr87.sh b/t/pr87.sh
index 121328d..d8bc6bb 100755
--- a/t/pr87.sh
+++ b/t/pr87.sh
@@ -45,7 +45,7 @@ AC_CONFIG_AUX_DIR([.])
 AM_INIT_AUTOMAKE
 AC_PROG_CC
 AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([`echo $subdirs | sed 's|\([a-z][a-z]*\)|\1/Makefile|g'`])
+AC_CONFIG_FILES([$(echo $subdirs | sed 's|\([a-z][a-z]*\)|\1/Makefile|g')])
 AC_OUTPUT
 EOF
 
diff --git a/t/primary-prefix-couples-force-valid.sh 
b/t/primary-prefix-couples-force-valid.sh
index 064db2b..e7ea634 100755
--- a/t/primary-prefix-couples-force-valid.sh
+++ b/t/primary-prefix-couples-force-valid.sh
@@ -77,7 +77,7 @@ $ACLOCAL
 $AUTOMAKE -a
 $AUTOCONF
 
-cwd=`pwd` || fatal_ "cannot get current working directory"
+cwd=$(pwd) || fatal_ "getting current working directory"
 ./configure --prefix="$cwd/_inst"
 
 $MAKE install
diff --git a/t/print-libdir.sh b/t/print-libdir.sh
index f5764b3..0c69942 100755
--- a/t/print-libdir.sh
+++ b/t/print-libdir.sh
@@ -19,7 +19,7 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
-libdir=`$AUTOMAKE --print-libdir` || Exit 1
+libdir=$($AUTOMAKE --print-libdir) || Exit 1
 case $libdir in /*);; *) Exit 1;; esac
 test -d "$libdir"
 test "$libdir" = "$am_pkgvdatadir"
diff --git a/t/py-compile-basedir.sh b/t/py-compile-basedir.sh
index 1504f55..03617fb 100755
--- a/t/py-compile-basedir.sh
+++ b/t/py-compile-basedir.sh
@@ -28,7 +28,7 @@ cp "$am_scriptdir/py-compile" . \
   || fatal_ "failed to fetch auxiliary script py-compile"
 
 f=__init__
-for d in foo foo/bar "`pwd`/foo" . .. ../foo ''; do
+for d in foo foo/bar "$(pwd)/foo" . .. ../foo ''; do
   if test -z "$d"; then
     d2=.
   else
diff --git a/t/py-compile-basic2.sh b/t/py-compile-basic2.sh
index dfa992c..3a09f45 100755
--- a/t/py-compile-basic2.sh
+++ b/t/py-compile-basic2.sh
@@ -21,7 +21,7 @@
 required=python
 . ./defs || Exit 1
 
-ocwd=`pwd` || Exit 99
+ocwd=$(pwd) || fatal_ "getting current working directory"
 
 pyfiles="
   foo.py
diff --git a/t/py-compile-usage.sh b/t/py-compile-usage.sh
index 19883b0..9dfe0a7 100755
--- a/t/py-compile-usage.sh
+++ b/t/py-compile-usage.sh
@@ -43,15 +43,15 @@ month='(0[0-9]|1[012])'
 day='([012][0-9]|3[01])'
 hour='([01][0-9]|2[0123])'
 LC_ALL=C $EGREP "^py-compile $year-$month-$day\.$hour" stdout
-test `wc -l <stdout` -eq 1
+test $(wc -l <stdout) -eq 1
 
 # Unknown option.
 
 for opt in -b -d --foo; do
   ./py-compile $opt 2>stderr && { cat stderr >&2; Exit 1; }
   cat stderr >&2
-  grep "^py-compile: unrecognized option ['\`]$opt'" stderr
-  grep "^Try [\`']py-compile --help' for more information" stderr
+  grep "^py-compile: unrecognized option '$opt'" stderr
+  grep "^Try 'py-compile --help' for more information" stderr
 done
 
 # Missing option argument.
@@ -59,8 +59,8 @@ done
 for opt in --basedir --destdir; do
   ./py-compile $opt 2>stderr && { cat stderr >&2; Exit 1; }
   cat stderr >&2
-  grep "^py-compile: option ['\`]$opt' requires an argument" stderr
-  grep "^Try [\`']py-compile --help' for more information" stderr
+  grep "^py-compile: option '$opt' requires an argument" stderr
+  grep "^Try 'py-compile --help' for more information" stderr
 done
 
 # Missing files.
@@ -69,7 +69,7 @@ for args in '' '--basedir dir' '--destdir dir'; do
   ./py-compile $args 2>stderr && { cat stderr >&2; Exit 1; }
   cat stderr >&2
   grep '^py-compile: no files given' stderr
-  grep "^Try [\`']py-compile --help' for more information" stderr
+  grep "^Try 'py-compile --help' for more information" stderr
 done
 
 :
diff --git a/t/python-pr10995.sh b/t/python-pr10995.sh
index 3efa5d0..375b792 100755
--- a/t/python-pr10995.sh
+++ b/t/python-pr10995.sh
@@ -44,14 +44,12 @@ $AUTOCONF
 $AUTOMAKE --add-missing
 test -f py-compile
 
-inst=`pwd`/inst
-
-./configure --prefix="$inst"
+./configure --prefix="$(pwd)/inst"
 $MAKE install
-test -f "$inst/py/yes.py"
-test -f "$inst/py/yes.pyc"
-test ! -f "$inst/py/no.py"
-test ! -f "$inst/py/no.pyc"
+test -f inst/py/yes.py
+test -f inst/py/yes.pyc
+test ! -f inst/py/no.py
+test ! -f inst/py/no.pyc
 
 $MAKE disttest
 
diff --git a/t/python-vars.sh b/t/python-vars.sh
index 56c2b61..97a45c9 100755
--- a/t/python-vars.sh
+++ b/t/python-vars.sh
@@ -30,8 +30,8 @@ PYTHON=python
 # vary among different python installations, so we need more relaxed
 # and ad-hoc checks for them.  Also, more proper "functional" checks
 # on them should be done in the 'python-virtualenv.test' test.
-PYTHON_VERSION=`$PYTHON -c 'import sys; print(sys.version[:3])'` || Exit 1
-PYTHON_PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'` || Exit 1
+PYTHON_VERSION=$($PYTHON -c 'import sys; print(sys.version[:3])') || Exit 1
+PYTHON_PLATFORM=$($PYTHON -c 'import sys; print(sys.platform)') || Exit 1
 PYTHON_EXEC_PREFIX='${exec_prefix}'
 PYTHON_PREFIX='${prefix}'
 pkgpythondir="\${pythondir}/$me"
diff --git a/t/python-virtualenv.sh b/t/python-virtualenv.sh
index c534e8d..15653a6 100755
--- a/t/python-virtualenv.sh
+++ b/t/python-virtualenv.sh
@@ -34,8 +34,8 @@ if test -z "$VIRTUAL_ENV"; then
   framework_failure_ "can't activate python virtual environment"
 fi
 
-cwd=`pwd`
-py_version=`python -c 'import sys; print("%u.%u" % 
tuple(sys.version_info[:2]))'`
+cwd=$(pwd) || fatal_ "getting current working directory"
+py_version=$(python -c 'import sys; print("%u.%u" % 
tuple(sys.version_info[:2]))')
 py_site=$VIRTUAL_ENV/lib/python$py_version/site-packages
 
 # We need control over the package name.
diff --git a/t/python.sh b/t/python.sh
index de8c0bb..0fe5d12 100755
--- a/t/python.sh
+++ b/t/python.sh
@@ -53,8 +53,8 @@ $AUTOMAKE Makefile3
 grep "py" Makefile.in Makefile2.in Makefile3.in # For debugging.
 
 for f in Makefile.in Makefile2.in Makefile3.in; do
-  test `grep -c '^py_compile =' $f` -eq 1
-  test `grep -c '^am__py_compile =' $f` -eq 1
+  test $(grep -c '^py_compile =' $f) -eq 1
+  test $(grep -c '^am__py_compile =' $f) -eq 1
 done
 
 :
diff --git a/t/python10.sh b/t/python10.sh
index b28c3a4..cc1fd5f 100755
--- a/t/python10.sh
+++ b/t/python10.sh
@@ -50,11 +50,13 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-mkdir inst
-inst=`pwd`/inst
-mkdir build
-cd build
-../configure --prefix="$inst"
+inst=inst_
+mkdir inst_ build_
+cd build_
+
+cwd=$(pwd) || fatal_ "getting current working directory"
+
+../configure --prefix="$cwd/$inst" one=0
 $MAKE install
 test -f "$inst/your/two.py"
 test -f "$inst/your/two.pyc"
@@ -67,7 +69,7 @@ test ! -f "$inst/your/two.py"
 test ! -f "$inst/your/two.pyc"
 test ! -f "$inst/your/two.pyo"
 
-../configure --prefix="$inst" one=1
+../configure --prefix=$cwd/"$inst" one=1
 $MAKE install
 test ! -f "$inst/your/two.py"
 test ! -f "$inst/your/two.pyc"
diff --git a/t/python12.sh b/t/python12.sh
index 3faeb45..d7b0cc7 100755
--- a/t/python12.sh
+++ b/t/python12.sh
@@ -36,10 +36,8 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-rm -rf inst build
-mkdir inst
-instdir=`pwd`/inst
-mkdir build
+instdir=$(pwd)/inst
+mkdir inst build
 cd build
 ../configure --prefix="/usr"
 $MAKE install DESTDIR=$instdir
diff --git a/t/python3.sh b/t/python3.sh
index 72021cd..33c4275 100755
--- a/t/python3.sh
+++ b/t/python3.sh
@@ -36,14 +36,12 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-mkdir inst
-inst=`pwd`/inst
 mkdir build
 cd build
-../configure --prefix="$inst"
+../configure --prefix="$(pwd)/inst"
 $MAKE install
-test -f "$inst/my/one.py"
-test -f "$inst/my/one.pyc"
-test -f "$inst/my/one.pyo"
+test -f inst/my/one.py
+test -f inst/my/one.pyc
+test -f inst/my/one.pyo
 
 :
diff --git a/t/python5b.sh b/t/python5b.sh
index b382b38..366c9b1 100755
--- a/t/python5b.sh
+++ b/t/python5b.sh
@@ -32,7 +32,7 @@ cat > bin/my-python << 'END'
 exec python ${1+"$@"}
 END
 chmod a+x bin/my-python
-PATH=`pwd`/bin$PATH_SEPARATOR$PATH
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH
 
 : > Makefile.am
 
diff --git a/t/python6.sh b/t/python6.sh
index 0e09a43..245cf4f 100755
--- a/t/python6.sh
+++ b/t/python6.sh
@@ -33,6 +33,6 @@ $AUTOMAKE --add-missing
 
 # Simulate no Python.
 ./configure PYTHON=:
-test x"`cat py`" = x:
+test x"$(cat py)" = x:
 
 :
diff --git a/t/python7.sh b/t/python7.sh
index ec0ac07..93f0c96 100755
--- a/t/python7.sh
+++ b/t/python7.sh
@@ -33,6 +33,6 @@ $AUTOCONF
 $AUTOMAKE --add-missing
 
 ./configure
-test x"`cat py`" = x:
+test x"$(cat py)" = x:
 
 :
diff --git a/t/python9.sh b/t/python9.sh
index e567adc..a992aab 100755
--- a/t/python9.sh
+++ b/t/python9.sh
@@ -33,6 +33,6 @@ $AUTOCONF
 $AUTOMAKE --add-missing
 
 ./configure
-test x"`cat py.out`" = x0:1
+test x"$(cat py.out)" = x0:1
 
 :
diff --git a/t/remake-subdir-long-time.sh b/t/remake-subdir-long-time.sh
index 8f31740..7bbc1d4 100755
--- a/t/remake-subdir-long-time.sh
+++ b/t/remake-subdir-long-time.sh
@@ -38,7 +38,7 @@ mkdir sub
 # Both aclocal and automake are expected to run one and just one time.
 # Create and use wrappers that will verify that.
 
-ocwd=`pwd` || fatal_ "cannot get current working directory"
+ocwd=$(pwd) || fatal_ "cannot get current working directory"
 
 mkdir bin
 
diff --git a/t/remake11.sh b/t/remake11.sh
index b88254f..93ef224 100755
--- a/t/remake11.sh
+++ b/t/remake11.sh
@@ -21,7 +21,7 @@
 
 . ./defs || Exit 1
 
-ocwd=`pwd` || Exit 1
+ocwd=$(pwd) || fatal_ "getting current working directory"
 
 magic1=::MagicStringOne::
 magic2=__MagicStringTwo__
@@ -43,7 +43,8 @@ done
 echo AC_OUTPUT >> "$ocwd"/configure.ac
 : > Makefile.am
 unset d i
-bottom=`pwd`
+
+bottom=$(pwd) || fatal_ "getting current working directory"
 
 cd "$ocwd"
 
diff --git a/t/remake6.sh b/t/remake6.sh
index c48c1b8..b6a3340 100755
--- a/t/remake6.sh
+++ b/t/remake6.sh
@@ -35,30 +35,29 @@ $AUTOCONF
 ./configure
 $MAKE
 
+do_check ()
+{
+  $MAKE >stdout || { cat stdout; Exit 1; }
+  cat stdout
+  test $(grep -c " --run " stdout) -eq 1
+}
+
 # Now, we are set up.  Ensure that, for either missing Makefile.in,
 # or updated Makefile.am, rebuild rules are run, and run exactly once
 # only.
 
 rm -f Makefile.in
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-test `grep -c " --run " stdout` -eq 1
+do_check
 
 rm -f sub/Makefile.in
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-test `grep -c " --run " stdout` -eq 1
+do_check
 
 $sleep  # Let touched files appear newer.
 
 touch Makefile.am
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-test `grep -c " --run " stdout` -eq 1
+do_check
 
 touch sub/Makefile.am
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-test `grep -c " --run " stdout` -eq 1
+do_check
 
 :
diff --git a/t/remake9a.sh b/t/remake9a.sh
index 7ee3075..2f4349a 100755
--- a/t/remake9a.sh
+++ b/t/remake9a.sh
@@ -80,7 +80,7 @@ for vpath in : false; do
   remake_
   $FGREP FINGERPRINT Makefile # For debugging.
   $FGREP $magic1 Makefile
-  test x"`./foo.sh`" = x"$magic1"
+  test x"$(./foo.sh)" = x"$magic1"
 
   $sleep
   echo 'sed "s/^\\(FINGERPRINT\\)=.*/\\1='$magic2'/"' \
@@ -89,7 +89,7 @@ for vpath in : false; do
   $FGREP FINGERPRINT Makefile # For debugging.
   $FGREP $magic1 Makefile && Exit 1
   $FGREP $magic2 Makefile
-  test x"`./foo.sh`" = x"$magic2"
+  test x"$(./foo.sh)" = x"$magic2"
 
   $sleep
   echo cat > $srcdir/tweak-configure-in # Make it a no-op again.
diff --git a/t/remake9b.sh b/t/remake9b.sh
index cab606e..4e0bfdc 100755
--- a/t/remake9b.sh
+++ b/t/remake9b.sh
@@ -82,7 +82,7 @@ for vpath in : false; do
   remake_
   $FGREP FINGERPRINT Makefile # For debugging.
   $FGREP $magic1 Makefile
-  test x"`./foo.sh`" = x"$magic1"
+  test x"$(./foo.sh)" = x"$magic1"
 
   $sleep
   echo 'sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = '$magic2'/"' \
@@ -91,7 +91,7 @@ for vpath in : false; do
   $FGREP FINGERPRINT Makefile # For debugging.
   $FGREP $magic1 Makefile && Exit 1
   $FGREP $magic2 Makefile
-  test x"`./foo.sh`" = x"$magic2"
+  test x"$(./foo.sh)" = x"$magic2"
 
   $sleep
   echo cat > $srcdir/tweak-makefile-am # Make it a no-op again.
diff --git a/t/remake9c.sh b/t/remake9c.sh
index efbec30..5ed7893 100755
--- a/t/remake9c.sh
+++ b/t/remake9c.sh
@@ -84,7 +84,7 @@ for vpath in : false; do
   remake_
   $FGREP FINGERPRINT Makefile # For debugging.
   $FGREP $magic1 Makefile
-  test x"`./foo.sh`" = x"$magic1"
+  test x"$(./foo.sh)" = x"$magic1"
 
   $sleep
   echo "echo 'AC_DEFUN([my_fingerprint], [$magic2])'" \
@@ -93,7 +93,7 @@ for vpath in : false; do
   $FGREP FINGERPRINT Makefile # For debugging.
   $FGREP $magic1 Makefile && Exit 1
   $FGREP $magic2 Makefile
-  test x"`./foo.sh`" = x"$magic2"
+  test x"$(./foo.sh)" = x"$magic2"
 
   $sleep
   echo : > $srcdir/tweak-acinclude-m4 # Make it a no-op again.
diff --git a/t/remake9d.sh b/t/remake9d.sh
index dddb083..5f4892b 100755
--- a/t/remake9d.sh
+++ b/t/remake9d.sh
@@ -84,7 +84,7 @@ for vpath in : false; do
   remake_
   $FGREP FINGERPRINT Makefile # For debugging.
   $FGREP $magic1 Makefile
-  test x"`./foo.sh`" = x"$magic1"
+  test x"$(./foo.sh)" = x"$magic1"
 
   $sleep
   echo "sed 's/.*dnl *%%%.*/AC_DEFUN([my_fingerprint], [$magic2])/'" \
@@ -93,7 +93,7 @@ for vpath in : false; do
   $FGREP FINGERPRINT Makefile # For debugging.
   $FGREP $magic1 Makefile && Exit 1
   $FGREP $magic2 Makefile
-  test x"`./foo.sh`" = x"$magic2"
+  test x"$(./foo.sh)" = x"$magic2"
 
   $sleep
   echo cat > $srcdir/tweak-aclocal-m4 # Make it a no-op again.
diff --git a/t/self-check-cleanup.tap b/t/self-check-cleanup.tap
index 21c6388..d379c43 100755
--- a/t/self-check-cleanup.tap
+++ b/t/self-check-cleanup.tap
@@ -23,7 +23,7 @@ plan_ 43
 
 # We still need a little hack to make ./defs work outside automake's
 # tree 'tests' subdirectory.  Not a big deal.
-sed "s|^am_top_builddir=.*|am_top_builddir='`pwd`'|" \
+sed "s|^am_top_builddir=.*|am_top_builddir='$(pwd)'|" \
   "$am_top_builddir"/defs-static >defs-static
 diff "$am_top_builddir"/defs-static defs-static \
   && fatal_ "failed to edit defs-static"
@@ -40,7 +40,7 @@ fi
 export have_symlinks # Is used also by spawned shells.
 
 # Don't let a failure poison all subsequent tests.
-do_clean ()
+do_clean_setup ()
 {
   # Don't try to be smart and use find here, that has caused issues
   # and extra ERROR results in the past.  Be dumb and safe.
@@ -50,6 +50,8 @@ do_clean ()
   rm -rf t
 }
 
+do_clean_setup
+
 # Exporting 'keep_testdirs' to "yes" in the environment should cause
 # the cleanup code not to be run, so that the temporary directories
 # are left on disk.
@@ -57,9 +59,9 @@ command_ok_ '"keep_testdirs=yes" causes testdir to be kept 
around' eval '
      env keep_testdirs=yes \
        $AM_TEST_RUNNER_SHELL -c ". ./defs && echo okok >foo" t/dummy.sh \
      && test -f t/dummy.dir/foo \
-     && test okok = `cat t/dummy.dir/foo`'
+     && test okok = $(cat t/dummy.dir/foo)'
 
-do_clean
+do_clean_setup
 
 # Check that pre-test cleanup works also with directories with
 # "null" permissions, and containing broken symlinks.
@@ -82,7 +84,7 @@ command_ok_ "pre-cleanup removed low-perms testdir" \
                && test ! -d t/dummy.dir \
                && test ! -r t/dummy.dir'
 
-do_clean
+do_clean_setup
 
 # Check that post-test cleanup works also with directories with
 # "null" permissions, and containing broken symlinks.
@@ -109,7 +111,7 @@ command_ok_ "post-cleanup removed null-perms testdir" \
                && test ! -d t/dummy.dir \
                && test ! -r t/dummy.dir'
 
-do_clean
+do_clean_setup
 
 # Check that pre-test cleanup does not unduly change the permissions of
 # files to which symlinks in the temporary test directory point to.
@@ -133,7 +135,7 @@ if test $have_symlinks = yes; then
 
   command_ok_ "post-cleanup with testdir with zero-perms symlinks" \
               $AM_TEST_RUNNER_SHELL -c '
-    ocwd=`pwd` || exit 1
+    ocwd=$(pwd) || exit 1
     stderr_fileno_=2
     . ./defs || Exit 1
     ln -s "$ocwd/dir" "$ocwd/file" .
@@ -152,7 +154,7 @@ else # $have_symlinks = no
   skip_row_ 6 "symlinks not supported"
 fi
 
-do_clean
+do_clean_setup
 
 # Check that the cleanup trap does not remove the temporary
 # test directory in case of test failure, skip, hard-error,
@@ -168,7 +170,7 @@ for st in 1 2 3 10 77 99 126 127 130 255; do
   " t/dummy.sh
   command_ok_ "testdir not removed if exiting with status $st" \
               test -f t/dummy.dir/foo
-  do_clean
+  do_clean_setup
 done
 
 for sig in 1 2 3 9 13 15; do
@@ -185,7 +187,7 @@ for sig in 1 2 3 9 13 15; do
   " t/dummy.sh
   command_ok_ "testdir not removed if getting signal $sig" \
               test -f t/dummy.dir/foo
-  do_clean
+  do_clean_setup
 done
 
 :
diff --git a/t/self-check-dir.tap b/t/self-check-dir.tap
index 424367e..6a0fbd3 100755
--- a/t/self-check-dir.tap
+++ b/t/self-check-dir.tap
@@ -29,7 +29,7 @@ keep_testdirs=; unset keep_testdirs
 
 # This needs to be consistent with what $AM_TEST_RUNNER_SHELL
 # deems to be the current working directory.
-cwd=`$AM_TEST_RUNNER_SHELL -c 'pwd'` \
+cwd=$($AM_TEST_RUNNER_SHELL -c 'pwd') \
   || fatal_ "can't get current working directory"
 echo "$cwd"
 
@@ -48,17 +48,17 @@ do_check ()
 
 do_check 'testdir has the expected path' \
          'unset am_create_testdir' \
-         'case `pwd` in '"$cwd"'/t/_self.dir);; *) Exit 1;; esac'
+         'case $(pwd) in '"$cwd"'/t/_self.dir);; *) Exit 1;; esac'
 
 do_check 'fully pre-populated testdir' \
          'unset am_create_testdir' \
          'test -f install-sh || Exit 1
           test -f configure.ac || Exit 1
-          case `pwd` in '"$cwd"'/t/_self.dir) : ;; *) Exit 1;; esac'
+          case $(pwd) in '"$cwd"'/t/_self.dir) : ;; *) Exit 1;; esac'
 
 do_check 'testdir has the expected path' \
          'am_create_testdir=empty' \
-         'case `pwd` in '"$cwd"'/t/_self.dir) : ;; *) Exit 1;; esac'
+         'case $(pwd) in '"$cwd"'/t/_self.dir) : ;; *) Exit 1;; esac'
 
 do_check 'do not pre-populate testdir' \
          'am_create_testdir=empty' \
@@ -70,6 +70,6 @@ do_check 'do not create nor chdir in testdir' \
           test ! -f t/_self.dir || Exit 1
           test ! -r t/_self.dir || Exit 1
           grep "self-check-dir\.tap" Makefile || Exit 1
-          case `pwd` in '"$cwd"') : ;; *) Exit 1;; esac'
+          case $(pwd) in '"$cwd"') : ;; *) Exit 1;; esac'
 
 :
diff --git a/t/self-check-explicit-skips.sh b/t/self-check-explicit-skips.sh
index 7a92671..ffab44d 100755
--- a/t/self-check-explicit-skips.sh
+++ b/t/self-check-explicit-skips.sh
@@ -15,43 +15,41 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Sanity check for the automake testsuite.
-# Check creation/removal of temporary test working directory by './defs'.
+# Check that our testsuite framework can be instructed not to consider
+# an early exit due to some command exiting unexpectedly with status 77.
 
-am_create_testdir=empty
+am_create_testdir=no
 . ./defs || Exit 1
 
-# We still need a little hack to make ./defs work outside automake's
-# tree 'tests' subdirectory.  Not a big deal.
-sed "s|^am_top_builddir=.*|am_top_builddir='`pwd`'|" \
-  "$am_top_builddir"/defs-static > defs-static
-diff "$am_top_builddir"/defs-static defs-static \
-  && fatal_ "failed to edit defs-static"
-cp "$am_top_builddir"/defs .
-
 set +e
 
 unset am_explicit_skips stderr_fileno_
 AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
 
-# I'm a lazy typist.
-sh=$AM_TEST_RUNNER_SHELL
+# FIXME: this can be simplified when we improve our runtime checks on the
+# testsuite shell to ensure it supports "VAR=val shell_func" correctly.
+run_dummy_test ()
+{
+  env $2 $AM_TEST_RUNNER_SHELL -c "am_create_testdir=no; . ./defs; $1" \
+                                  dummy.sh
+}
 
-$sh -c '. ./defs; (exit 77); exit 77' dummy.test
+run_dummy_test '(exit 77); exit 77'
 test $? -eq 77 || Exit 1
 
-am_explicit_skips=no $sh -c '. ./defs; sh -c "exit 77"' dummy.test
+run_dummy_test 'sh -c "exit 77"' am_explicit_skips=no
 test $? -eq 77 || Exit 1
 
-am_explicit_skips=yes $sh -c '. ./defs; (exit 77); exit 77' dummy.test
+run_dummy_test '(exit 77); exit 77' am_explicit_skips=yes 
 test $? -eq 78 || Exit 1
 
-am_explicit_skips=y $sh -c '. ./defs; sh -c "exit 77"' dummy.test
+run_dummy_test 'sh -c "exit 77"' am_explicit_skips=y
 test $? -eq 78 || Exit 1
 
-am_explicit_skips=yes $sh -c '. ./defs; Exit 77' dummy.test
+run_dummy_test 'Exit 77' am_explicit_skips=yes
 test $? -eq 77 || Exit 1
 
-am_explicit_skips=y $sh -c '. ./defs; skip_ "foo"' dummy.test
+run_dummy_test 'skip_ "foo"' am_explicit_skips=y
 test $? -eq 77 || Exit 1
 
 :
diff --git a/t/self-check-me.tap b/t/self-check-me.tap
index cddc9b5..2b720fa 100755
--- a/t/self-check-me.tap
+++ b/t/self-check-me.tap
@@ -48,7 +48,7 @@ do_check abc. 'abc\.'
 
 # If we override $me, ./defs should not modify it.
 
-s=`$AM_TEST_RUNNER_SHELL -c 'me=foo.sh && . ./defs && echo me=$me' bad.sh`
+s=$($AM_TEST_RUNNER_SHELL -c 'me=foo.sh && . ./defs && echo me=$me' bad.sh)
 command_ok_ "override of \$me before ./defs causes no error" \
             test $? -eq 0
 
diff --git a/t/self-check-reexec.tap b/t/self-check-reexec.tap
index e19a681..3feeb62 100755
--- a/t/self-check-reexec.tap
+++ b/t/self-check-reexec.tap
@@ -25,7 +25,7 @@ plan_ 32
 
 unset AM_TESTS_REEXEC BASH_VERSION || :
 
-cwd=`pwd` || fatal_ "cannot get current working directory"
+cwd=$(pwd) || fatal_ "getting current working directory"
 cp "$am_top_builddir"/defs . || fatal_ "fetching 'defs' from top_builddir"
 
 #
@@ -179,13 +179,13 @@ check_reexec_message ()
   dir=$1; shift
   get_ddata "$dir"
   $sh "${dir}${dsep}dummy.sh" "$@" \
-    | grep "^dummy: exec $AM_TEST_RUNNER_SHELL ${dir}${dsep}dummy\\.sh $*\$" \
+    | grep "^exec $AM_TEST_RUNNER_SHELL ${dir}${dsep}dummy\\.sh $*\$" \
     && r='ok' || r='not ok'
   result_ "$r" "$sh display re-exec message [$dname] [args: $*]"
 }
 
 ./dummy.sh a b \
-  | grep "^dummy: exec $AM_TEST_RUNNER_SHELL \\./dummy\\.sh a b$" \
+  | grep "^exec $AM_TEST_RUNNER_SHELL \\./dummy\\.sh a b$" \
   && r='ok' || r='not ok'
 result_ "$r" "direct run display re-exec message [args: a b]"
 
diff --git a/t/self-check-sanity.sh b/t/self-check-sanity.sh
deleted file mode 100755
index 8e31afa..0000000
--- a/t/self-check-sanity.sh
+++ /dev/null
@@ -1,77 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2011-2012 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Sanity check for the automake testsuite.
-# Test the sanity checks performed by the 'defs' script.  Also check
-# that we can use 'defs' elsewhere, when we duplicate some of the
-# infrastructure from the automake/tests subdirectory.
-
-am_create_testdir=empty
-. ./defs || Exit 1
-
-# Avoid to confuse traces from child processed with our own traces.
-show_stderr ()
-{
-  sed 's/^/ | /' stderr >&2
-}
-
-AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-
-source_defs=". '$am_top_builddir/defs'"
-
-if $AM_TEST_RUNNER_SHELL -c "$source_defs" dummy.sh 2>stderr; then
-  show_stderr
-  Exit 1
-else
-  show_stderr
-  grep 'defs-static: not found in current directory' stderr
-fi
-
-sed 's|^am_top_srcdir=.*|am_top_srcdir=foo|' \
-  "$am_top_builddir"/defs-static > defs-static
-if $AM_TEST_RUNNER_SHELL -c "$source_defs" t/dummy.sh 2>stderr; then
-  show_stderr
-  Exit 1
-else
-  show_stderr
-  grep 'foo/defs-static\.in not found.*check \$am_top_srcdir' stderr
-fi
-
-sed 's|^am_top_builddir=.*|am_top_builddir=foo|' \
-  "$am_top_builddir"/defs-static > defs-static
-if $AM_TEST_RUNNER_SHELL -c "$source_defs" t/dummy.sh 2>stderr; then
-  show_stderr
-  Exit 1
-else
-  show_stderr
-  grep 'foo/defs-static not found.*check \$am_top_builddir' stderr
-fi
-
-# We still need a little hack to make ./defs work outside automake's
-# tree 'tests' subdirectory.  Not a big deal.
-sed "s|^am_top_builddir=.*|am_top_builddir='`pwd`'|" \
-  "$am_top_builddir"/defs-static > defs-static
-# Redefining *srcdir and *builddir variables in the environment shouldn't
-# cause problems
-env \
-  builddir=bad-dir srcdir=bad-dir \
-  top_builddir=bad-dir top_srcdir=bad-dir \
-  abs_builddir=bad-dir abs_srcdir=bad-dir \
-  abs_top_builddir=bad-dir abs_top_srcdir=bad-dir \
-  $AM_TEST_RUNNER_SHELL -c "$source_defs && echo '!OK!' > ../foo" t/dummy.sh
-$FGREP '!OK!' t/foo
-
-:
diff --git a/t/self-check-seq.tap b/t/self-check-seq.tap
index a92230e..8162a4e 100755
--- a/t/self-check-seq.tap
+++ b/t/self-check-seq.tap
@@ -26,7 +26,7 @@ unset stderr_fileno_ || :
 check_work ()
 {
   desc=$1 args=$2 exp=$3
-  st=0; got=`seq_ $args` || st=$?
+  st=0; got=$(seq_ $args) || st=$?
   command_ok_ "$desc [exit status = 0]" test $st -eq 0
   command_ok_ "$desc [output]" test x"$exp" = x"$got"
 }
diff --git a/t/silent-many-gcc.sh b/t/silent-many-gcc.sh
index 8ad0720..f746dc1 100755
--- a/t/silent-many-gcc.sh
+++ b/t/silent-many-gcc.sh
@@ -58,7 +58,7 @@ do_and_check_silent_build ()
   grep 'CXXLD .*baz' stdout
   grep 'CCLD .*bla'  stdout
 
-  if $rebuild; then :; else
+  if ! $rebuild; then
     grep 'YACC .*foo6\.' stdout
     grep 'YACC .*baz6\.' stdout
     grep 'LEX .*foo5\.'  stdout
@@ -84,7 +84,7 @@ do_and_check_verbose_build ()
 
   $EGREP '(CC|CXX|FC|F77|LD) ' stdout && Exit 1
 
-  if $rebuild; then :; else
+  if ! $rebuild; then
     grep 'ylwrap ' stdout
     $EGREP '(LEX|YACC) ' stdout && Exit 1
   fi
diff --git a/t/silent-many-generic.sh b/t/silent-many-generic.sh
index cd37672..1318d98 100755
--- a/t/silent-many-generic.sh
+++ b/t/silent-many-generic.sh
@@ -59,7 +59,7 @@ do_and_check_silent_build ()
   grep 'CXXLD .*baz' stdout
   grep 'CCLD .*bla'  stdout
 
-  if $rebuild; then :; else
+  if ! $rebuild; then
     grep 'YACC .*foo6\.' stdout
     grep 'YACC .*baz6\.' stdout
     grep 'LEX .*foo5\.'  stdout
@@ -85,7 +85,7 @@ do_and_check_verbose_build ()
 
   $EGREP '(CC|CXX|FC|F77|LD) ' stdout && Exit 1
 
-  if $rebuild; then :; else
+  if ! $rebuild; then
     grep 'ylwrap ' stdout
     $EGREP '(LEX|YACC) ' stdout && Exit 1
   fi
@@ -215,7 +215,7 @@ cp foo6.y sub/baz6.y
 
 mkdir bin
 saved_PATH=$PATH; export saved_PATH
-PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
 
 $ACLOCAL
 $AUTOMAKE --add-missing
diff --git a/t/specflg6.sh b/t/specflg6.sh
index f420cdf..5566ae3 100755
--- a/t/specflg6.sh
+++ b/t/specflg6.sh
@@ -41,7 +41,7 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-uncondval=`$FGREP 'foo-foo.o: foo.c' Makefile.in`
+uncondval=$($FGREP 'foo-foo.o: foo.c' Makefile.in)
 
 cat >> Makefile.am << 'END'
 foo_SOURCES += $(BAR_SRCS)
@@ -49,7 +49,7 @@ END
 
 $AUTOMAKE
 
-condval=`$FGREP 'foo-foo.o: foo.c' Makefile.in`
+condval=$($FGREP 'foo-foo.o: foo.c' Makefile.in)
 
 test "x$uncondval" = "x$condval"
 
diff --git a/t/specflg7.sh b/t/specflg7.sh
index 26ad75c..8caf930 100755
--- a/t/specflg7.sh
+++ b/t/specflg7.sh
@@ -58,7 +58,7 @@ $MAKE
 ./true | grep true
 ./false | grep false
 
-objext=`sed -n -e 's/^OBJEXT = //p' < Makefile`
+objext=$(sed -n -e 's/^OBJEXT = //p' < Makefile)
 test -f ./t-false.$objext
 test -f ./f-false.$objext
 
diff --git a/t/specflg8.sh b/t/specflg8.sh
index 435ce16..d0c198f 100755
--- a/t/specflg8.sh
+++ b/t/specflg8.sh
@@ -57,7 +57,7 @@ $MAKE
 ./true
 ./false && Exit 1
 
-objext=`sed -n -e 's/^OBJEXT = //p' < Makefile`
+objext=$(sed -n -e 's/^OBJEXT = //p' < Makefile)
 test -f ./true-true.$objext
 test -f ./false-true.$objext
 
diff --git a/t/spy.sh b/t/spy.sh
index 0d087a4..dd486ce 100755
--- a/t/spy.sh
+++ b/t/spy.sh
@@ -80,18 +80,18 @@ touch b c
 $sleep
 : > a
 $MAKE
-test "`cat a`" = ''
+test x"$(cat a)" = x
 $sleep
 touch b
 $MAKE
-test "`cat a`" = rule1
+test "$(cat a)" = "rule1"
 # Ensure a is strictly newer than b, so HP-UX make does not execute rule2.
 $sleep
 : > a
 $sleep
 touch c
 $MAKE
-test "`cat a`" = rule2
+test "$(cat a)" = "rule2"
 
 # Unfortunately, the following is not portable to FreeBSD/NetBSD/OpenBSD
 # make, see explanation above.
diff --git a/t/stdlib.sh b/t/stdlib.sh
index 1594707..d2268d2 100755
--- a/t/stdlib.sh
+++ b/t/stdlib.sh
@@ -41,12 +41,11 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-q="[\`'\"]"
 badname='not a standard library name'
 # We're specifically testing for line-number information.
-grep "^Makefile\\.am:1:.*${q}sub/foo${q}.*$badname" stderr
+grep "^Makefile\\.am:1:.*'sub/foo'.*$badname" stderr
 grep "^Makefile\\.am:1:.*sub/libfoo\\.a" stderr
-grep "^foo\\.mk:5:.*${q}zardoz\\.a${q}.*$badname" stderr
+grep "^foo\\.mk:5:.*'zardoz\\.a'.*$badname" stderr
 grep "^foo\\.mk:5:.*libzardoz\\.a" stderr
 
 :
diff --git a/t/strip.sh b/t/strip.sh
index dfefcd9..abc2c86 100755
--- a/t/strip.sh
+++ b/t/strip.sh
@@ -41,7 +41,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-prefix=`cd install && pwd` || Exit 1
+prefix=$(cd install && pwd) || Exit 99
 ./configure --prefix="$prefix"
 $MAKE
 $MAKE install-strip
diff --git a/t/strip2.sh b/t/strip2.sh
index 49a5c06..9c43496 100755
--- a/t/strip2.sh
+++ b/t/strip2.sh
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Ensure install-strip works when STRIP consists of more than one word.
-# This test needs GNU binutils strip.  See sister test strip3.
+# This test needs GNU binutils strip.  See sister test 'strip3.sh'.
 
 required='cc strip'
 . ./defs || Exit 1
@@ -32,21 +32,14 @@ bin_PROGRAMS = foo
 lib_LIBRARIES = libfoo.a
 END
 
-cat > foo.c << 'END'
-int main () { return 0; }
-END
-
-cat > libfoo.c << 'END'
-int foo () { return 0; }
-END
-
+echo 'int main (void) { return 0; }' > foo.c
+echo 'int foo (void) { return 0; }' > libfoo.c
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-prefix=`pwd`/inst
-./configure --prefix="$prefix" STRIP='strip --verbose'
+./configure --prefix="$(pwd)/inst" STRIP='strip --verbose'
 $MAKE
 $MAKE install-strip
 
diff --git a/t/strip3.sh b/t/strip3.sh
index 187e8a5..8979016 100755
--- a/t/strip3.sh
+++ b/t/strip3.sh
@@ -15,7 +15,8 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Ensure install-strip works when STRIP consists of more than one word.
-# This test needs GNU binutils strip.  Libtool variant.
+# This test needs GNU binutils strip.  Libtool variant.  See sister
+# test 'strip2.sh'.
 
 required='cc libtoolize strip'
 . ./defs || Exit 1
@@ -32,21 +33,15 @@ bin_PROGRAMS = foo
 lib_LTLIBRARIES = libfoo.la
 END
 
-cat > foo.c << 'END'
-int main () { return 0; }
-END
-
-cat > libfoo.c << 'END'
-int foo () { return 0; }
-END
+echo 'int main (void) { return 0; }' > foo.c
+echo 'int foo (void) { return 0; }' > libfoo.c
 
 libtoolize
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-prefix=`pwd`/inst
-./configure --prefix="$prefix" STRIP='strip --verbose'
+./configure --prefix="$(pwd)/inst" STRIP='strip --verbose'
 $MAKE
 $MAKE install-strip
 
diff --git a/t/subobj-clean-lt-pr10697.sh b/t/subobj-clean-lt-pr10697.sh
index cfebc99..4d8b18c 100755
--- a/t/subobj-clean-lt-pr10697.sh
+++ b/t/subobj-clean-lt-pr10697.sh
@@ -33,18 +33,16 @@ AC_OUTPUT
 END
 
 oPATH=$PATH
-ocwd=`pwd` || fatal_ "getting current working directory"
+ocwd=$(pwd) || fatal_ "getting current working directory"
 
 # An rm(1) wrapper that fails when invoked too many times.
 mkdir rm-wrap
 max_rm_invocations=6
 count_file=$ocwd/rm-wrap/count
 cat > rm-wrap/rm <<END
-#!/bin/sh
-set -e
-count=\`cat '$count_file'\`
-count=\`expr \$count + 1\`
-if test \$count -le $max_rm_invocations; then :; else
+#!$AM_TEST_RUNNER_SHELL -e
+count=\$((\$(cat '$count_file') + 1))
+if ! test \$count -le $max_rm_invocations; then
   echo "rm invoked more than $max_rm_invocations times" >&2
   exit 1
 fi
diff --git a/t/subobj-clean-pr10697.sh b/t/subobj-clean-pr10697.sh
index 69abc10..a545658 100755
--- a/t/subobj-clean-pr10697.sh
+++ b/t/subobj-clean-pr10697.sh
@@ -34,21 +34,19 @@ END
 echo "OBJEXT='@OBJEXT@'" > get-objext.in
 
 oPATH=$PATH
-ocwd=`pwd` || fatal_ "getting current working directory"
+ocwd=$(pwd) || fatal_ "getting current working directory"
 
 # An rm(1) wrapper that fails when invoked too many times.
 mkdir rm-wrap
 max_rm_invocations=3
 count_file=$ocwd/rm-wrap/count
 cat > rm-wrap/rm <<END
-#!/bin/sh
-set -e
-count=\`cat '$count_file'\`
-count=\`expr \$count + 1\`
-if test \$count -le $max_rm_invocations; then :; else
+#!$AM_TEST_RUNNER_SHELL -e
+count=\$((\$(cat '$count_file') + 1))
+test \$count -le $max_rm_invocations || {
   echo "rm invoked more than $max_rm_invocations times" >&2
   exit 1
-fi
+}
 echo "\$count" > '$count_file'
 PATH='$oPATH'; export PATH
 exec rm "\$@"
diff --git a/t/subobj11a.sh b/t/subobj11a.sh
index 461325a..aeb4fa9 100755
--- a/t/subobj11a.sh
+++ b/t/subobj11a.sh
@@ -57,7 +57,7 @@ $AUTOMAKE -a
 
 ./configure --enable-dependency-tracking
 
-depdir=`sed -n 's/^ *DEPDIR *= *//p' Makefile`
+depdir=$(sed -n 's/^ *DEPDIR *= *//p' Makefile)
 if test x"$depdir" != x; then
   depdir=src/$depdir
 else
diff --git a/t/subobj11b.sh b/t/subobj11b.sh
index 129b6ea..eef884f 100755
--- a/t/subobj11b.sh
+++ b/t/subobj11b.sh
@@ -69,7 +69,7 @@ grep 'include.*//.*foobar' Makefile.in && Exit 1
 # internals are changed.
 for x in zardoz0 zardoz1 path/to/zardoz2 another/path/to/zardoz3; do
   case $x in
-   */*) d=`echo $x | sed 's,[^/]*$,,'`; b=`echo $x | sed 's,^.*/,,'`;;
+   */*) d=$(echo $x | sed 's,[^/]*$,,'); b=$(echo $x | sed 's,^.*/,,');;
      *) d=''; b=$x;;
   esac
   # Be a little lax in the regexp, to account for automake conditionals,
diff --git a/t/subobj9.sh b/t/subobj9.sh
index f706edf..6964a80 100755
--- a/t/subobj9.sh
+++ b/t/subobj9.sh
@@ -37,7 +37,7 @@ END
 
 cat > Makefile.am << 'END'
 noinst_LTLIBRARIES = libfoo.la
-libfoo_la_SOURCES = src/foo.cc .//src/bar.cc  # The `.//' is meant.
+libfoo_la_SOURCES = src/foo.cc .//src/bar.cc  # The './/' is meant.
 .PHONY: print
 print:
        @echo BEG1: "$(LTCXXCOMPILE)" :1END
diff --git a/t/subobjname.sh b/t/subobjname.sh
index bef3bf0..9d3b63d 100755
--- a/t/subobjname.sh
+++ b/t/subobjname.sh
@@ -59,14 +59,14 @@ grep '^am_c_OBJECTS = ' Makefile.in
 grep '^am_d_OBJECTS = ' Makefile.in
 
 # Now the actual test.  Are both values equal?
-cobj=`sed -n '/^am_c_OBJECTS = / {
-                s/.* = \(.*\)$/\1/
-                p
-              }' Makefile.in`
-dobj=`sed -n '/^am_d_OBJECTS = / {
-                s/^.* = \(.*\)$/\1/
-                p
-              }' Makefile.in`
+cobj=$(sed -n '/^am_c_OBJECTS = / {
+                 s/.* = \(.*\)$/\1/
+                 p
+               }' Makefile.in)
+dobj=$(sed -n '/^am_d_OBJECTS = / {
+                 s/^.* = \(.*\)$/\1/
+                 p
+              }' Makefile.in)
 test "$cobj" = "$dobj"
 
 :
diff --git a/t/subst-no-trailing-empty-line.sh 
b/t/subst-no-trailing-empty-line.sh
index 2069e3a..aed52bc 100755
--- a/t/subst-no-trailing-empty-line.sh
+++ b/t/subst-no-trailing-empty-line.sh
@@ -70,7 +70,7 @@ $AUTOMAKE
 # For debugging.
 $EGREP -n 'ABCD|am__empty' Makefile.in
 # Sanity check.
-test `$EGREP -c "^[ address@hidden@ @address@hidden $tab]*$bs?$" Makefile.in` 
-eq 3
+test $($EGREP -c "^[ address@hidden@ @address@hidden $tab]*$bs?$" Makefile.in) 
-eq 3
 
 ./configure
 {
diff --git a/t/subst3.sh b/t/subst3.sh
index cc81063..f201336 100755
--- a/t/subst3.sh
+++ b/t/subst3.sh
@@ -23,7 +23,7 @@ cat >> configure.ac <<'EOF'
 AC_PROG_CC
 AM_PROG_AR
 AC_PROG_RANLIB
-if test -n "$doit"; then
+if test x"$doit" = x"yes"; then
   AC_SUBST([basehdr], [sub/base.h])
   AC_SUBST([nobasehdr], [sub/nobase.h])
   AC_SUBST([basedata], [sub/base.dat])
@@ -139,7 +139,7 @@ rm -f install-sh
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a --copy
-./configure --prefix "`pwd`/inst" --program-prefix=p doit=yes
+./configure --prefix "$(pwd)/inst" --program-prefix=p doit=yes
 
 $MAKE
 $MAKE test-install-data
@@ -147,9 +147,9 @@ $MAKE test-install-exec
 $MAKE uninstall
 $MAKE clean
 
-test `find inst/foo -type f -print | wc -l` = 0
+test $(find inst/foo -type f -print | wc -l) -eq 0
 
-./configure --prefix "`pwd`/inst" --program-prefix=p doit=
+./configure --prefix "$(pwd)/inst" --program-prefix=p doit=no
 
 $MAKE
 $MAKE test-install-nothing-data
@@ -162,14 +162,14 @@ $MAKE uninstall
 $MAKE distclean
 mkdir build
 cd build
-../configure --prefix "`pwd`/inst" --program-prefix=p doit=yes
+../configure --prefix "$(pwd)/inst" --program-prefix=p doit=yes
 $MAKE
 $MAKE test-install-data
 $MAKE test-install-exec
 $MAKE uninstall
-test `find inst/foo -type f -print | wc -l` = 0
+test $(find inst/foo -type f -print | wc -l) -eq 0
 
-../configure --prefix "`pwd`/inst" --program-prefix=p doit=
+../configure --prefix "$(pwd)/inst" --program-prefix=p doit=no
 $MAKE
 $MAKE test-install-nothing-data
 $MAKE test-install-nothing-exec
diff --git a/t/substtarg.sh b/t/substtarg.sh
index 2e695f8..5fd4f82 100755
--- a/t/substtarg.sh
+++ b/t/substtarg.sh
@@ -46,5 +46,6 @@ $ACLOCAL
 AUTOMAKE_fails
 grep 'address@hidden@.a' stderr
 $AUTOMAKE -Wno-override
-num=`grep 'address@hidden@.a:' Makefile.in | wc -l`
-test $num -eq 1
+test $(grep -c 'address@hidden@.a:' Makefile.in) -eq 1
+
+:
diff --git a/t/suffix.sh b/t/suffix.sh
index 600aedf..899118d 100755
--- a/t/suffix.sh
+++ b/t/suffix.sh
@@ -46,13 +46,13 @@ for use_arlib in false :; do
 
   $AUTOMAKE $am_warns -i
   grep '^ *\.c' Makefile.in # For debugging.
-  test `grep -c '^\.c\.o:' Makefile.in` -eq 1
-  test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
+  test $(grep -c '^\.c\.o:' Makefile.in) -eq 1
+  test $(grep -c '^\.c\.obj:' Makefile.in) -eq 1
 
   $AUTOMAKE $am_warns
   grep '^ *\.c' Makefile.in # For debugging.
-  test `grep -c '^\.c\.o:' Makefile.in` -eq 1
-  test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
+  test $(grep -c '^\.c\.o:' Makefile.in) -eq 1
+  test $(grep -c '^\.c\.obj:' Makefile.in) -eq 1
 
 done
 
diff --git a/t/suffix2.sh b/t/suffix2.sh
index 6dd2616..5bf24d3 100755
--- a/t/suffix2.sh
+++ b/t/suffix2.sh
@@ -43,12 +43,12 @@ $ACLOCAL
 
 $AUTOMAKE -a
 grep '^ *\.c' Makefile.in # For debugging.
-test `grep -c '^\.c\.o:' Makefile.in` -eq 1
-test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
+test $(grep -c '^\.c\.o:' Makefile.in) -eq 1
+test $(grep -c '^\.c\.obj:' Makefile.in) -eq 1
 
 $AUTOMAKE -i
 grep '^ *\.c' Makefile.in # For debugging.
-test `grep -c '^\.c\.o:' Makefile.in` -eq 1
-test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
+test $(grep -c '^\.c\.o:' Makefile.in) -eq 1
+test $(grep -c '^\.c\.obj:' Makefile.in) -eq 1
 
 :
diff --git a/t/symlink.sh b/t/symlink.sh
index f4b4338..b57f02a 100755
--- a/t/symlink.sh
+++ b/t/symlink.sh
@@ -35,6 +35,6 @@ AUTOMAKE_fails --add-missing
 grep '^configure\.ac:3: .*missing.*error while making link' stderr
 grep '^configure\.ac:3: .*install-sh.*error while making link' stderr
 
-test `$FGREP -c 'error while making link' stderr` -eq 2
+test $(grep -c 'error while making link' stderr) -eq 2
 
 :
diff --git a/t/tap-bailout-suppress-later-errors.sh 
b/t/tap-bailout-suppress-later-errors.sh
index ff83887..bbdd542 100755
--- a/t/tap-bailout-suppress-later-errors.sh
+++ b/t/tap-bailout-suppress-later-errors.sh
@@ -66,8 +66,8 @@ grep '^PASS: baz\.test 1$'            stdout
 
 $FGREP 'Not seen' stdout && Exit 1
 
-test `$FGREP -c ': foo.test' stdout` -eq 1
-test `$FGREP -c ': bar.test' stdout` -eq 2
-test `$FGREP -c ': baz.test' stdout` -eq 2
+test $($FGREP -c ': foo.test' stdout) -eq 1
+test $($FGREP -c ': bar.test' stdout) -eq 2
+test $($FGREP -c ': baz.test' stdout) -eq 2
 
 :
diff --git a/t/tap-basic.sh b/t/tap-basic.sh
index c19c326..2e12e6e 100755
--- a/t/tap-basic.sh
+++ b/t/tap-basic.sh
@@ -138,7 +138,7 @@ test -f test-suite.log
 
 grep '^ERROR: bail\.test - Bail out!' stdout
 grep '^PASS:' stdout && Exit 1
-test `$FGREP -c ': bail.test' stdout` -eq 1
+test $($FGREP -c ': bail.test' stdout) -eq 1
 $FGREP 'success.test' stdout && Exit 1
 
 # Override TEST_LOGS from the command line, making it point to a test
diff --git a/t/tap-diagnostic-custom.sh b/t/tap-diagnostic-custom.sh
index c90f46f..fc2d36a 100755
--- a/t/tap-diagnostic-custom.sh
+++ b/t/tap-diagnostic-custom.sh
@@ -57,7 +57,7 @@ for string in \
 '## leave its behaviour in this context undefined for the moment.'
 do
   case $string in '##'*) continue;; esac
-  i=`expr $i + 1`
+  i=$(($i + 1))
   unindent >> Makefile.am << END
     TEST_EXTENSIONS += .t$i
     TESTS += foo$i.t$i
diff --git a/t/tap-diagnostic.sh b/t/tap-diagnostic.sh
index c849d65..e23d96b 100755
--- a/t/tap-diagnostic.sh
+++ b/t/tap-diagnostic.sh
@@ -118,6 +118,6 @@ grep "^# all.test:${ws0p}bar${ws0p}$" stdout
 grep "^# all.test:${ws1p}zardoz${ws0p}$" stdout
 grep "^# all.test:${ws1p}foo  bar${tab}baz${ws0p}$" stdout
 
-test `grep -c '^# all\.test:' stdout` -eq 4
+test $(grep -c '^# all\.test:' stdout) -eq 4
 
 :
diff --git a/t/tap-fancy.sh b/t/tap-fancy.sh
index 846a9d0..e17cc78 100755
--- a/t/tap-fancy.sh
+++ b/t/tap-fancy.sh
@@ -24,9 +24,9 @@
 #
 # From manpage Test::Harness::TAP(3):
 #
-# ``Lines written to standard output matching /^(not )?ok\b/ must be
+#   Lines written to standard output matching /^(not )?ok\b/ must be
 #   interpreted as test lines. All other lines must not be considered
-#   test output.''
+#   test output.
 #
 # Unfortunately, the exact format of TODO and SKIP directives is not as
 # clearly described in that manpage; but a simple reverse-engineering of
diff --git a/t/tap-fancy2.sh b/t/tap-fancy2.sh
index 6ab67c9..4bf014f 100755
--- a/t/tap-fancy2.sh
+++ b/t/tap-fancy2.sh
@@ -24,9 +24,9 @@
 #
 # From manpage Test::Harness::TAP(3):
 #
-# ``Lines written to standard output matching /^(not )?ok\b/ must be
+#   Lines written to standard output matching /^(not )?ok\b/ must be
 #   interpreted as test lines. All other lines must not be considered
-#   test output.''
+#   test output.
 #
 # Unfortunately, the exact format of TODO and SKIP directives is not as
 # clearly described in that manpage; but a simple reverse-engineering of
@@ -108,7 +108,7 @@ xfail=130 # = 4 * 34 - 6
 xpass=130 # = 4 * 34 - 6
 skip=130  # = 4 * 34 - 6
 error=0
-total=`expr $pass + $fail + $xfail + $xpass + $skip`
+total=$(($pass + $fail + $xfail + $xpass + $skip))
 
 # Even nastier!  But accordingly to the specifics, it should still work.
 for result in 'ok' 'not ok'; do
@@ -117,10 +117,10 @@ done
 echo "ok{[(<#${tab}SKIP>)]}" >> all.test
 
 # We have to update some test counts.
-xfail=`expr $xfail + 1`
-xpass=`expr $xpass + 1`
-skip=`expr $skip + 1`
-total=`expr $total + 3`
+xfail=$(($xfail + 1))
+xpass=$(($xpass + 1))
+skip=$(($skip + 1))
+total=$(($total + 3))
 
 # And add the test plan!
 echo 1..$total >> all.test
diff --git a/t/tap-global-log.sh b/t/tap-global-log.sh
index 29e582c..493a5a4 100755
--- a/t/tap-global-log.sh
+++ b/t/tap-global-log.sh
@@ -102,7 +102,7 @@ cat > skipall.test << 'END'
 END
 
 # We don't care about the exit status of "make check" here.
-TESTS="`echo *.test`" $MAKE -e check || :
+TESTS="$(echo *.test)" $MAKE -e check || :
 cat test-suite.log
 
 grep ':.*ok|not seen' test-suite.log && Exit 1
diff --git a/t/tap-global-result.sh b/t/tap-global-result.sh
index 30215c7..6d7a4dd 100755
--- a/t/tap-global-result.sh
+++ b/t/tap-global-result.sh
@@ -138,13 +138,13 @@ ok 4 # TODO
 Bail out!
 END
 
-tests=`echo *.test` # Also required later.
+tests=$(echo *.test) # Also required later.
 
 TESTS="$tests" $MAKE -e check >stdout && { cat stdout; Exit 1; }
 cat stdout
 
 # Dirty trick required here.
-for tst in `echo " $tests " | sed 's/.test / /'`; do
+for tst in $(echo " $tests " | sed 's/\.test / /'); do
   echo :copy-in-global-log: yes >> $tst.trs
 done
 
@@ -154,7 +154,7 @@ cat test-suite.log
 
 have_rst_section ()
 {
-  eqeq=`echo "$1" | sed 's/./=/g'`
+  eqeq=$(echo "$1" | sed 's/./=/g')
   # Assume $1 contains no RE metacharacters.
   sed -n "/^$1$/,/^$eqeq$/p" test-suite.log > got
   (echo "$1" && echo "$eqeq") > exp
diff --git a/t/tap-log.sh b/t/tap-log.sh
index 5faf838..92d63ec 100755
--- a/t/tap-log.sh
+++ b/t/tap-log.sh
@@ -103,8 +103,8 @@ for result in xfail fail xpass skip error; do
   $FGREP "$pmarker $result $pmarker" my.log || st=1
   $FGREP "$cmarker $result $cmarker" my.log || st=1
 done
-test `$FGREP -c "$pmarker" my.log` -eq 5
-test `$FGREP -c "$cmarker" my.log` -eq 5
+test $($FGREP -c "$pmarker" my.log) -eq 5
+test $($FGREP -c "$cmarker" my.log) -eq 5
 
 # Passed test scripts shouldn't be mentioned in the global log.
 $EGREP '(^pass|[^x]pass)\.test' my.log && Exit 1
@@ -139,8 +139,8 @@ test ! -f my.log
 test ! -f test-suite.log
 # Check that VERBOSE causes the global testsuite log to be
 # emitted on stdout.
-out=`cat stdout`
-log=`cat global.log`
+out=$(cat stdout)
+log=$(cat global.log)
 case $out in *"$log"*) ;; *) Exit 1;; esac
 
 touch error2.log test-suite.log my.log
diff --git a/t/tap-more.sh b/t/tap-more.sh
index 7970d7f..baa7e28 100755
--- a/t/tap-more.sh
+++ b/t/tap-more.sh
@@ -127,14 +127,14 @@ for try in 0 1; do
   count_test_results total=6 pass=4 fail=0 xpass=0 xfail=1 skip=1 error=0
   grep '^PASS: 1\.test 1 - mu$' stdout
   grep '^SKIP: 1\.test 2 zardoz # SKIP$' stdout
-  test `$FGREP -c '1.test' stdout` -eq 2
+  test $(grep -c '1\.test' stdout) -eq 2
   grep '^PASS: 2\.test 1$' stdout
   grep '^XFAIL: 2\.test 2 # TODO not implemented$' stdout
   grep '^PASS: 2\.test 3$' stdout
-  test `$FGREP -c '2.test' stdout` -eq 3
+  test $(grep -c '2\.test' stdout) -eq 3
   grep '^PASS: 3\.test 1 - blah blah blah$' stdout
   grep '^# 3\.test: Some diagnostic$' stdout
-  test `$FGREP -c '3.test' stdout` -eq 2
+  test $(grep -c '3\.test' stdout) -eq 2
 
   # Failure.
 
@@ -152,15 +152,15 @@ for try in 0 1; do
   count_test_results total=7 pass=4 fail=1 xpass=0 xfail=1 skip=0 error=1
   grep '^PASS: 1\.test 1 - mu$' stdout
   grep '^FAIL: 1\.test 2 zardoz$' stdout
-  test `$FGREP -c '1.test' stdout` -eq 2
+  test $(grep -c '1\.test' stdout) -eq 2
   grep '^PASS: 2\.test 1$' stdout
   grep '^XFAIL: 2\.test 2 # TODO not implemented$' stdout
   grep '^PASS: 2\.test 3$' stdout
-  test `$FGREP -c '2.test' stdout` -eq 3
+  test $(grep -c '2\.test' stdout) -eq 3
   grep '^PASS: 3\.test 1 - blah blah blah$' stdout
   grep '^# 3\.test: Some diagnostic$' stdout
   grep '^ERROR: 3\.test - Bail out! Kernel Panic$' stdout
-  test `$FGREP -c '3.test' stdout` -eq 3
+  test $(grep -c '3\.test' stdout) -eq 3
 
   cd $srcdir
 
diff --git a/t/tap-no-spurious-numbers.sh b/t/tap-no-spurious-numbers.sh
index 4cdace0..0c07510 100755
--- a/t/tap-no-spurious-numbers.sh
+++ b/t/tap-no-spurious-numbers.sh
@@ -57,16 +57,16 @@ $
 >
 END
 
-n=`wc -l <prefixes`
+n=$(wc -l <prefixes)
 
 # See the loop below to understand this initialization.
-pass=`expr $n '*' 3`
+pass=$(($n * 3))
 fail=$pass
-skip=`expr $pass - 3`
+skip=$(($pass - 3))
 xfail=$skip
 xpass=$xfail
 error=0
-total=`expr $pass + $fail + $skip + $xfail + $xpass`
+total=$(($pass + $fail + $skip + $xfail + $xpass))
 
 echo 1..$total > all.test
 
@@ -86,8 +86,10 @@ done >> all.test
 cat all.test # For debugging.
 
 # Sanity checks.
-grep '#.*#' all.test && framework_failure_ "creating all.test"
-test `wc -l <all.test` -lt $highno || framework_failure_ "creating all.test"
+grep '#.*#' all.test \
+  && framework_failure_ "creating all.test"
+test $(wc -l <all.test) -lt $highno \
+  || framework_failure_ "creating all.test"
 
 $MAKE check >stdout || :
 cat stdout
diff --git a/t/tap-no-spurious.sh b/t/tap-no-spurious.sh
index b9bca21..ea2993d 100755
--- a/t/tap-no-spurious.sh
+++ b/t/tap-no-spurious.sh
@@ -36,9 +36,9 @@ END
 
 # According to documentation of Test::Harness::TAP(3):
 #
-#  ``Lines written to standard output matching /^(not )?ok\b/
+#    Lines written to standard output matching /^(not )?ok\b/
 #    must be interpreted as test lines. All other lines must
-#    not be considered test output.''
+#    not be considered test output.
 
 cat >> all.test <<END
  ok
@@ -98,11 +98,11 @@ Bail out
 # Bail out!
 END
 
-cat all.test # For debugging.
 
-# Minor sanity check.
-test `grep -c '^ok1$' all.test` -eq 1 \
-  && test `grep -c '^not ok1$' all.test` -eq 1 \
+# Debugging info and minor sanity check.
+cat all.test \
+  && test $(grep -c '^ok1$' all.test) -eq 1 \
+  && test $(grep -c '^not ok1$' all.test) -eq 1 \
   || framework_failure_ "creating all.test"
 
 $MAKE check >stdout || { cat stdout; Exit 1; }
diff --git a/t/tap-number-wordboundary.sh b/t/tap-number-wordboundary.sh
index 324adb6..bd1bf8d 100755
--- a/t/tap-number-wordboundary.sh
+++ b/t/tap-number-wordboundary.sh
@@ -93,7 +93,7 @@ $
 END
 
 # Strip any extra whitespace, for Solaris' wc.
-planned=`wc -l <punctuation | tr -d " $tab"`
+planned=$(wc -l <punctuation | tr -d " $tab")
 
 echo 1..$planned > all.test
 awk '{print "ok " NR $0 }' punctuation >> all.test
diff --git a/t/tap-out-of-order.sh b/t/tap-out-of-order.sh
index 9e3d755..20bba0a 100755
--- a/t/tap-out-of-order.sh
+++ b/t/tap-out-of-order.sh
@@ -63,10 +63,10 @@ cat stdout
 
 count_test_results total=17 pass=8 fail=0 xpass=0 xfail=1 skip=0 error=8
 
-test `$FGREP -c ': a.test' stdout` -eq 3
-test `$FGREP -c ': b.test' stdout` -eq 5
-test `$FGREP -c ': c.test' stdout` -eq 4
-test `$FGREP -c ': d.test' stdout` -eq 5
+test $($FGREP -c ': a.test' stdout) -eq 3
+test $($FGREP -c ': b.test' stdout) -eq 5
+test $($FGREP -c ': c.test' stdout) -eq 4
+test $($FGREP -c ': d.test' stdout) -eq 5
 
 grep '^ERROR: a\.test 71 # OUT-OF-ORDER (expecting 3)$' stdout
 grep '^ERROR: b\.test 4 foo # OUT-OF-ORDER (expecting 3)$' stdout
diff --git a/t/tap-plan-malformed.sh b/t/tap-plan-malformed.sh
index 8aca466..99fd8c5 100755
--- a/t/tap-plan-malformed.sh
+++ b/t/tap-plan-malformed.sh
@@ -45,7 +45,7 @@ cat > e.test <<END
 0..0
 END
 
-tests_list=`echo *.test`
+tests_list=$(echo *.test)
 
 TESTS="$tests_list" $MAKE -e check >stdout && { cat stdout; Exit 1; }
 cat stdout
diff --git a/t/tap-plan-middle.sh b/t/tap-plan-middle.sh
index 1c752fc..3a63821 100755
--- a/t/tap-plan-middle.sh
+++ b/t/tap-plan-middle.sh
@@ -70,7 +70,7 @@ ok 4 # SKIP
 
 END
 
-tests=`echo *.test`
+tests=$(echo *.test)
 
 for tap_flags in "" "--comments"; do
   env TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS="$tests" \
diff --git a/t/tap-planskip-case-insensitive.sh 
b/t/tap-planskip-case-insensitive.sh
index 9de6bc5..f53534c 100755
--- a/t/tap-planskip-case-insensitive.sh
+++ b/t/tap-planskip-case-insensitive.sh
@@ -21,19 +21,18 @@
 
 . "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
 
-# These nested loops are clearer without indentation.
-
+# These nested loops below are clearer without indentation.
 i=0
 for c1 in s S; do
 for c2 in k K; do
 for c3 in i I; do
 for c4 in p P; do
-  i=`expr $i + 1`
-  case $i in ?) i=0$i; esac
-  echo "1..0 # $c1$c2$c3$c4 foobar" > $i.test
+  i=$(($i + 1))
+  case $i in ?) j=0$i;; *) j=$i;; esac
+  echo "1..0 # $c1$c2$c3$c4 foobar" > $j.test
 done; done; done; done
 
-TESTS="`echo *.test`" $MAKE -e check >stdout || { cat stdout; Exit 1; }
+TESTS="$(echo *.test)" $MAKE -e check >stdout || { cat stdout; Exit 1; }
 cat stdout
 
 count_test_results total=16 pass=0 fail=0 xpass=0 xfail=0 skip=16 error=0
diff --git a/t/tap-planskip-late.sh b/t/tap-planskip-late.sh
index e0d3513..52917d5 100755
--- a/t/tap-planskip-late.sh
+++ b/t/tap-planskip-late.sh
@@ -37,7 +37,7 @@ cat stdout
 
 grep '^SKIP: foo\.test .* from the last line$' stdout
 grep '^SKIP: bar\.test$' stdout
-test `grep -c ': .*\.test' stdout` -eq 2
+test $(grep -c ': .*\.test' stdout) -eq 2
 count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=0
 
 :
diff --git a/t/tap-planskip-later-errors.sh b/t/tap-planskip-later-errors.sh
index 7bf3cb1..f216f88 100755
--- a/t/tap-planskip-later-errors.sh
+++ b/t/tap-planskip-later-errors.sh
@@ -34,6 +34,6 @@ $MAKE check >stdout && { cat stdout; Exit 1; }
 cat stdout
 
 count_test_results total=4 pass=0 fail=0 xpass=0 xfail=0 skip=1 error=3
-test `grep -c '^ERROR: all\.test - multiple test plans' stdout` -eq 3
+test $(grep -c '^ERROR: all\.test - multiple test plans' stdout) -eq 3
 
 :
diff --git a/t/tap-planskip.sh b/t/tap-planskip.sh
index 142afd7..2c1d9de 100755
--- a/t/tap-planskip.sh
+++ b/t/tap-planskip.sh
@@ -72,6 +72,6 @@ grep '^SKIP: baz\.test' stdout # Deliberately laxer, see 
above for why.
 grep '^SKIP: wget\.test .* wget(1) not installed$' stdout
 grep '^SKIP: curl\.test .* Can'\''t connect to gnu\.org!$' stdout
 grep '^SKIP: mu\.test' stdout | $FGREP "$weirdchars" stdout
-test `grep -c ': .*\.test' stdout` -eq 6
+test $(grep -c ': .*\.test' stdout) -eq 6
 
 :
diff --git a/t/tap-realtime.sh b/t/tap-realtime.sh
index d874b0c..2cad91c 100755
--- a/t/tap-realtime.sh
+++ b/t/tap-realtime.sh
@@ -43,7 +43,7 @@ rm -f expect-check
 # out its output progressively and "in sync" with test execution -- it is
 # make that is stowing such output away instead of presenting it to the
 # user as soon as it gets it.
-if using_gmake; then :; else
+if ! using_gmake; then
   case $MAKE in
     *\ -j*) skip_ "doesn't with non-GNU concurrent make";;
   esac
diff --git a/t/tap-signal.tap b/t/tap-signal.tap
index e23deea..fce48bf 100755
--- a/t/tap-signal.tap
+++ b/t/tap-signal.tap
@@ -60,7 +60,7 @@ for sig in $all_signals; do
 END
   echo TESTS += signal-$sig.test >> Makefile.am
 done
-results_count=`ls *.test | wc -l | tr -d "$tab$sp"`
+results_count=$(ls *.test | wc -l | tr -d "$tab$sp")
 
 chmod a+x *.test
 
@@ -70,7 +70,7 @@ $AUTOMAKE
 
 ./configure
 
-system=`uname -s -r || echo unknown` # Needed later.
+system=$(uname -s -r || echo unknown) # Needed later.
 
 signal_caught ()
 {
@@ -120,7 +120,7 @@ command_ok_ '"make check" fails' eval '
 cat stdout # For debugging.
 
 command_ok_ "count of test results" count_test_results \
-  total=`expr $results_count '*' 2` \
+  total=$(($results_count * 2)) \
   pass=$results_count error=$results_count \
   fail=0 xpass=0 xfail=0 skip=0
 
diff --git a/t/tap-unplanned.sh b/t/tap-unplanned.sh
index e8d9dad..dce485c 100755
--- a/t/tap-unplanned.sh
+++ b/t/tap-unplanned.sh
@@ -148,7 +148,7 @@ for x in 'ok' 'ok 3' 'not ok' 'not ok # TODO' 'ok # TODO' 
'ok # SKIP'; do
 END
   $MAKE check >stdout && { cat stdout; Exit 1; }
   cat stdout
-  test `$FGREP -c ': all.test' stdout` -eq 4
+  test $($FGREP -c ': all.test' stdout) -eq 4
   $EGREP '^PASS: all\.test 1($| )' stdout
   $EGREP '^SKIP: all\.test 2($| )' stdout
   $EGREP ': all\.test 3($| )' stdout
diff --git a/t/tar-override.sh b/t/tar-override.sh
index 641ce86..0bf8ac7 100755
--- a/t/tar-override.sh
+++ b/t/tar-override.sh
@@ -21,7 +21,7 @@
 
 . ./defs || Exit 1
 
-cwd=`pwd` || fatal_ "couldn't get current working directory"
+cwd=$(pwd) || fatal_ "getting current working directory"
 
 echo AC_OUTPUT >> configure.ac
 
@@ -52,7 +52,7 @@ rm -f *.tar.* *has-run*
 
 TAR="$cwd/am--tar foo" $MAKE distcheck
 test -f $me-1.0.tar.gz
-test "`cat am--tar-has-run`" = foo
+test "$(cat am--tar-has-run)" = foo
 
 rm -f *.tar.* *has-run*
 
@@ -60,6 +60,6 @@ TAR=; unset TAR
 # Creative use of eval to pacify maintainer checks.
 eval \$'MAKE dist "TAR=./am--tar mu"'
 test -f $me-1.0.tar.gz
-test "`cat am--tar-has-run`" = mu
+test "$(cat am--tar-has-run)" = mu
 
 :
diff --git a/t/tar3.sh b/t/tar3.sh
index 403ce99..65997b1 100755
--- a/t/tar3.sh
+++ b/t/tar3.sh
@@ -31,7 +31,7 @@ $ACLOCAL
 AUTOMAKE_fails
 grep "^configure\.ac:2:.*mutually exclusive" stderr > tar-err
 cat tar-err
-test 1 = `wc -l < tar-err`
+test 1 -eq $(wc -l < tar-err)
 grep "'tar-pax'" tar-err
 grep "'tar-v7'"  tar-err
 
diff --git a/t/target-cflags.sh b/t/target-cflags.sh
index ad0e94d..97a95d8 100755
--- a/t/target-cflags.sh
+++ b/t/target-cflags.sh
@@ -60,7 +60,7 @@ mkdir build
 cd build
 ../configure
 $MAKE
-if cross_compiling; then :; else
+if ! cross_compiling; then
   ./foo
   ./bar
 fi
@@ -68,7 +68,7 @@ cd ..
 
 ./configure
 $MAKE
-if cross_compiling; then :; else
+if ! cross_compiling; then
   ./foo
   ./bar
 fi
diff --git a/t/test-driver-create-log-dir.sh b/t/test-driver-create-log-dir.sh
index dc8e681..3b08397 100755
--- a/t/test-driver-create-log-dir.sh
+++ b/t/test-driver-create-log-dir.sh
@@ -44,8 +44,8 @@ check-local: $(TEST_SUITE_LOG)
        test -f sub1/baz.trs
 END
 
-cat > checkdir-driver <<'END'
-#! /bin/sh
+echo "#!$AM_TEST_RUNNER_SHELL" > checkdir-driver
+cat >> checkdir-driver <<'END'
 set -e; set -u
 while test $# -gt 0; do
   case $1 in
@@ -60,8 +60,8 @@ done
 echo "log: $log_file" # For debugging.
 echo "trs: $trs_file" # Ditto.
 case $log_file in */*);; *) exit 1;; esac
-dir_log=`expr "$log_file" : '\(.*\)/[^/]*'`
-dir_trs=`expr "$trs_file" : '\(.*\)/[^/]*'`
+dir_log=${log_file%/*}
+dir_trs=${trs_file%/*}
 echo "dir_log: $dir_log" # For debugging.
 echo "dir_trs: $dir_trs" # Likewise.
 test x"$dir_trs" = x"$dir_log" || exit 1
diff --git a/t/test-driver-custom-multitest.sh 
b/t/test-driver-custom-multitest.sh
index c660ec2..28e1700 100755
--- a/t/test-driver-custom-multitest.sh
+++ b/t/test-driver-custom-multitest.sh
@@ -156,7 +156,7 @@ for vpath in : false; do
   grep '%% fail2 %%' test-suite.log
   grep '%% pass-fail %%' test-suite.log
   grep '%% pass-xpass-fail-xfail-skip-error %%' test-suite.log
-  test `grep -c '%% ' test-suite.log` -eq 4
+  test $(grep -c '%% ' test-suite.log) -eq 4
 
   TESTS='pass.t pass3-skip2-xfail.t' $MAKE -e check >stdout \
     || { cat stdout; cat test-suite.log; Exit 1; }
diff --git a/t/test-driver-custom-xfail-tests.sh 
b/t/test-driver-custom-xfail-tests.sh
index 14568c0..d8455de 100755
--- a/t/test-driver-custom-xfail-tests.sh
+++ b/t/test-driver-custom-xfail-tests.sh
@@ -143,8 +143,8 @@ $AUTOMAKE
 
 $MAKE check >stdout || { cat stdout; Exit 1; }
 cat stdout
-test `grep -c '^PASS:'  stdout` -eq 3
-test `grep -c '^XFAIL:' stdout` -eq 13
+test $(grep -c '^PASS:'  stdout) -eq 3
+test $(grep -c '^XFAIL:' stdout) -eq 13
 
 for dir in sub1 sub2; do
   cd $dir
@@ -152,9 +152,9 @@ for dir in sub1 sub2; do
   cp x2.test pass.test
   $MAKE check >stdout && { cat stdout; Exit 1; }
   cat stdout
-  test "`cat pass.trs`" = ":test-result: FAIL"
-  test "`cat x1.trs`"   = ":test-result: XPASS"
-  test "`cat x2.trs`"   = ":test-result: XFAIL"
+  test "$(cat pass.trs)" = ":test-result: FAIL"
+  test "$(cat x1.trs)"   = ":test-result: XPASS"
+  test "$(cat x2.trs)"   = ":test-result: XFAIL"
   grep '^FAIL: pass\.test$' stdout
   grep '^XPASS: x1\.test$'  stdout
   grep '^XFAIL: x2\.test$'  stdout
diff --git a/t/test-driver-custom.sh b/t/test-driver-custom.sh
index ce4a7fc..d56d661 100755
--- a/t/test-driver-custom.sh
+++ b/t/test-driver-custom.sh
@@ -41,7 +41,7 @@ LOG_DRIVER_FLAGS = _
 END
 
 mkdir sub bin
-PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
 
 cat > wrapper.skel <<'END'
 #! /bin/sh
diff --git a/t/test-driver-is-distributed.sh b/t/test-driver-is-distributed.sh
index 88f7982..73ce840 100755
--- a/t/test-driver-is-distributed.sh
+++ b/t/test-driver-is-distributed.sh
@@ -21,7 +21,7 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
-ocwd=`pwd` || fatal_ "getting current working directory"
+ocwd=$(pwd) || fatal_ "getting current working directory"
 
 for i in 1 2; do
   mkdir D$i
diff --git a/t/test-driver-strip-vpath.sh b/t/test-driver-strip-vpath.sh
index 0f51c3e..b2d8588 100755
--- a/t/test-driver-strip-vpath.sh
+++ b/t/test-driver-strip-vpath.sh
@@ -19,7 +19,7 @@
 
 . ./defs || Exit 1
 
-ocwd=`pwd` || fatal_ "cannot get current working directory"
+ocwd=$(pwd) || fatal_ "cannot get current working directory"
 
 mkdir src build
 mv install-sh missing configure.ac src
diff --git a/t/test-extensions-cond.sh b/t/test-extensions-cond.sh
index e081d79..c8d58ac 100755
--- a/t/test-extensions-cond.sh
+++ b/t/test-extensions-cond.sh
@@ -60,7 +60,7 @@ END
 
 for i in 1 2 3; do
   AUTOMAKE_fails $i
-  lineno=`sed -n 's/^## lineno //p' $i.am` \
+  lineno=$(sed -n 's/^## lineno //p' $i.am) \
     && test 0 -lt "$lineno" \
     || Exit 99
   grep "^$i\\.am:$lineno:.*TEST_EXTENSIONS.*conditional content" stderr
diff --git a/t/test-extensions.sh b/t/test-extensions.sh
index fa23481..c444489 100755
--- a/t/test-extensions.sh
+++ b/t/test-extensions.sh
@@ -39,7 +39,7 @@ $AUTOMAKE -a
 grep -i 'log' Makefile.in # For debugging.
 
 for lc in $valid_extensions; do
-  uc=`echo $lc | tr '[a-z]' '[A-Z]'`
+  uc=$(echo $lc | tr '[a-z]' '[A-Z]')
   $FGREP "\$(${uc}_LOG_COMPILER)" Makefile.in
   grep "^${uc}_LOG_COMPILE =" Makefile.in
   grep "^\.${lc}\.log:" Makefile.in
@@ -57,7 +57,7 @@ END
 
 AUTOMAKE_fails
 for suf in mu .x-y a-b .t.1 .6c .0 .11  @suf@ address@hidden@ '.=' '_&_'; do
-  suf2=`printf '%s\n' "$suf" | sed -e 's/\./\\./'`
+  suf2=$(printf '%s\n' "$suf" | sed -e 's/\./\\./')
   $EGREP "^Makefile\.am:2:.*invalid test extension.* $suf2( |$)" stderr
 done
 
diff --git a/t/test-log.sh b/t/test-log.sh
index 0e6065d..4a4dec3 100755
--- a/t/test-log.sh
+++ b/t/test-log.sh
@@ -106,12 +106,12 @@ for result in xfail fail xpass skip error; do
   $FGREP "$pmarker $result $pmarker" my.log || st=1
   $FGREP "$cmarker $result $cmarker" my.log || st=1
 done
-test `$FGREP -c "$pmarker" my.log` -eq 5
-test `$FGREP -c "$cmarker" my.log` -eq 5
+test $($FGREP -c "$pmarker" my.log) -eq 5
+test $($FGREP -c "$cmarker" my.log) -eq 5
 
 have_rst_section ()
 {
-  eqeq=`echo "$1" | sed 's/./=/g'`
+  eqeq=$(echo "$1" | sed 's/./=/g')
   # Assume $1 contains no RE metacharacters.
   sed -n "/^$1$/,/^$eqeq$/p" $2 > got
   (echo "$1" && echo "$eqeq") > exp
@@ -153,8 +153,8 @@ test ! -f my.log
 test ! -f test-suite.log
 # Check that VERBOSE causes the global testsuite log to be
 # emitted on stdout.
-out=`cat stdout`
-log=`cat global.log`
+out=$(cat stdout)
+log=$(cat global.log)
 case $out in *"$log"*) ;; *) Exit 1;; esac
 
 touch error2.log test-suite.log my.log
diff --git a/t/test-metadata-global-result.sh b/t/test-metadata-global-result.sh
index 4aa633f..d3c05f0 100755
--- a/t/test-metadata-global-result.sh
+++ b/t/test-metadata-global-result.sh
@@ -60,7 +60,7 @@ get_escaped_line()
 have_result ()
 {
    cat > exp; echo >> exp; echo logloglog >> exp
-   eline=`get_escaped_line exp`
+   eline=$(get_escaped_line exp)
    sed -n -e "/^$eline$/,/^logloglog$/p" test-suite.log > got
    cat exp; cat got
    diff exp got
diff --git a/t/test-metadata-recheck.sh b/t/test-metadata-recheck.sh
index 8874745..0a106b3 100755
--- a/t/test-metadata-recheck.sh
+++ b/t/test-metadata-recheck.sh
@@ -109,7 +109,7 @@ cat > n-100 <<END
 :recheck: no
 END
 
-rechecked=`echo y-[0-9]*`
+rechecked=$(echo y-[0-9]*)
 
 for t in [yn]-[0-9]*; do echo $t; done \
   | sed 's/.*/TESTS += &/' >> Makefile.am
diff --git a/t/test-trs-basic.sh b/t/test-trs-basic.sh
index 42456b4..b8d13d8 100755
--- a/t/test-trs-basic.sh
+++ b/t/test-trs-basic.sh
@@ -68,11 +68,11 @@ for vpath in : false; do
   $srcdir/configure
 
   $MAKE tb
-  test x"`cat tb`" = x"foo bar sub/zardoz"
+  test x"$(cat tb)" = x"foo bar sub/zardoz"
   rm -f tb
   # Please don't change the order of the stuff in TESTS, below.
   TESTS='foo.test foo2.sh foo-log foolog.test a.log.b.sh 0.exe' $MAKE -e tb
-  test x"`cat tb`" = x"foo foo2 foo-log foolog a.log.b 0.exe"
+  test x"$(cat tb)" = x"foo foo2 foo-log foolog a.log.b 0.exe"
   rm -f tb
 
   cd $srcdir
diff --git a/t/testsuite-summary-count.sh b/t/testsuite-summary-count.sh
index 1d13e7e..8d2ce74 100755
--- a/t/testsuite-summary-count.sh
+++ b/t/testsuite-summary-count.sh
@@ -110,12 +110,12 @@ xpass_count=23
 error_count=17
 tests_count=120
 
-pass=` seq_ 1 $pass_count  | sed 's/.*/pass-&.t/'`
-skip=` seq_ 1 $skip_count  | sed 's/.*/skip-&.t/'`
-xfail=`seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/'`
-fail=` seq_ 1 $fail_count  | sed 's/.*/fail-&.t/'`
-xpass=`seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/'`
-error=`seq_ 1 $error_count | sed 's/.*/error-&.t/'`
+ pass=$(seq_ 1 $pass_count  | sed 's/.*/pass-&.t/')
+ skip=$(seq_ 1 $skip_count  | sed 's/.*/skip-&.t/')
+xfail=$(seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/')
+ fail=$(seq_ 1 $fail_count  | sed 's/.*/fail-&.t/')
+xpass=$(seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/')
+error=$(seq_ 1 $error_count | sed 's/.*/error-&.t/')
 
 do_check $pass $skip $xfail $fail $xpass $error <<END
 $header
@@ -139,12 +139,12 @@ fail_count=126
 xpass_count=17
 error_count=9
 
-pass=` seq_ 1 $pass_count  | sed 's/.*/pass-&.t/'`
-skip=` seq_ 1 $skip_count  | sed 's/.*/skip-&.t/'`
-xfail=`seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/'`
-fail=` seq_ 1 $fail_count  | sed 's/.*/fail-&.t/'`
-xpass=`seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/'`
-error=`seq_ 1 $error_count | sed 's/.*/error-&.t/'`
+ pass=$(seq_ 1 $pass_count  | sed 's/.*/pass-&.t/')
+ skip=$(seq_ 1 $skip_count  | sed 's/.*/skip-&.t/')
+xfail=$(seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/')
+ fail=$(seq_ 1 $fail_count  | sed 's/.*/fail-&.t/')
+xpass=$(seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/')
+error=$(seq_ 1 $error_count | sed 's/.*/error-&.t/')
 
 do_check $pass $skip $xfail $fail $xpass $error <<END
 $header
diff --git a/t/transform.sh b/t/transform.sh
index 7aa958e..6a89862 100755
--- a/t/transform.sh
+++ b/t/transform.sh
@@ -50,11 +50,14 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-./configure --program-prefix=gnu- --prefix "`pwd`/inst" --mandir 
"`pwd`/inst/man"
+cwd=$(pwd) || fatal_ "getting current working directory"
+
+./configure --program-prefix=gnu- --prefix "$cwd/inst" \
+                                  --mandir "$cwd/inst/man"
 $MAKE
 $MAKE test-install
 $MAKE uninstall
-test `find inst -type f -print | wc -l` = 0
+test $(find inst -type f -print | wc -l) -eq 0
 
 # Opportunistically test for installdirs.
 rm -rf inst
diff --git a/t/transform2.sh b/t/transform2.sh
index a4a94f7..357e6b7 100755
--- a/t/transform2.sh
+++ b/t/transform2.sh
@@ -66,17 +66,20 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
-./configure --program-transform-name='s/[12]//' --prefix "`pwd`/inst" --mandir 
"`pwd`/inst/man"
+cwd=$(pwd) || fatal_ "getting current working directory"
+
+./configure --program-transform-name='s/[12]//' --prefix "$cwd/inst" \
+                                                --mandir "$cwd/inst/man"
 $MAKE
 $MAKE test-install
 $MAKE uninstall
-test `find inst -type f -print | wc -l` = 0
+test $(find inst -type f -print | wc -l) -eq 0
 
 # Also squash all file types in question.
 
 # On newer Cygwin versions, that won't work, likely due to overly
 # aggressive appending of '.exe' suffix when copying/renaming Windows
-# executables).  So let's skip this part of the test if we detect the
+# executables.  So let's skip this part of the test if we detect the
 # faulty heuristic is present.  See also:
 # <http://lists.gnu.org/archive/html/automake-patches/2010-08/msg00153.html>
 # <http://thread.gmane.org/gmane.os.cygwin/119380>
@@ -86,10 +89,11 @@ chmod a+x foo bar.exe
 cp foo bar && cmp foo bar \
   || skip_ "your Cygwin is too aggressive in tweaking '.exe' suffixes"
 
-./configure --program-transform-name='s/.*/foo/' --prefix "`pwd`/inst" 
--mandir "`pwd`/inst/man"
+./configure --program-transform-name='s/.*/foo/' --prefix "$cwd/inst" \
+                                                 --mandir "$cwd/inst/man"
 $MAKE
 $MAKE test-install-foo
 $MAKE uninstall
-test `find inst -type f -print | wc -l` = 0
+test $(find inst -type f -print | wc -l) -eq 0
 
 :
diff --git a/t/transform3.sh b/t/transform3.sh
index 6f1b811..9efefa2 100755
--- a/t/transform3.sh
+++ b/t/transform3.sh
@@ -78,12 +78,12 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-./configure --program-prefix=gnu- --prefix "`pwd`/inst"
+./configure --program-prefix=gnu- --prefix "$(pwd)/inst"
 
 $MAKE test-install
 
 $MAKE uninstall
-test `find inst -type f -print | wc -l` = 0
+test $(find inst -type f -print | wc -l) -eq 0
 
 # Opportunistically test for installdirs.
 rm -rf inst
diff --git a/t/txinfo19.sh b/t/txinfo19.sh
index 63417f8..a77c419 100755
--- a/t/txinfo19.sh
+++ b/t/txinfo19.sh
@@ -38,7 +38,7 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure "--infodir=`pwd`/_inst"
+./configure "--infodir=$(pwd)/_inst"
 $MAKE
 
 # Make sure .iNN files are installed.
diff --git a/t/txinfo21.sh b/t/txinfo21.sh
index 732b5d8..fd9e679 100755
--- a/t/txinfo21.sh
+++ b/t/txinfo21.sh
@@ -120,7 +120,8 @@ AM_MAKEINFOHTMLFLAGS = --no-headers --no-split
 AM_MAKEINFOFLAGS = --unsupported-option
 EOF
 $AUTOMAKE
-./configure --prefix "`pwd`"
+./configure --prefix "$(pwd)"
+
 $MAKE html
 test -f main.html
 test -f sub/main2.html
diff --git a/t/txinfo26.sh b/t/txinfo26.sh
index e336bba..223a4ea 100755
--- a/t/txinfo26.sh
+++ b/t/txinfo26.sh
@@ -46,15 +46,21 @@ $AUTOCONF
 $MAKE
 $MAKE distclean
 
-case `pwd` in
+abscwd=$(pwd) || fatal_ "getting current working directory"
+
+case $abscwd in
   *\ * | *\    *)
     skip_ "this test might fail in a directory containing white spaces";;
 esac
 
 mkdir build
 cd build
-../configure "--srcdir=`pwd`/.." "--prefix=`pwd`/_inst" 
"--infodir=`pwd`/_inst/info"
+../configure --srcdir="$abscwd" \
+             --prefix="$abscwd/build/_inst" \
+            --infodir="$abscwd/build/_inst/info"
+
 $MAKE install
+
 test -f ../main.info
 test ! -f ./main.info
 test -f _inst/info/main.info
diff --git a/t/txinfo27.sh b/t/txinfo27.sh
index 131300a..f94c0bc 100755
--- a/t/txinfo27.sh
+++ b/t/txinfo27.sh
@@ -41,6 +41,8 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure "--prefix=`pwd`/inst" "--infodir=`pwd`/inst/info"
+./configure --prefix="$(pwd)/inst" --infodir="$(pwd)/inst/info"
 $MAKE install-info
 test -f inst/info/main.info
+
+:
diff --git a/t/txinfo29.sh b/t/txinfo29.sh
index a0013d2..eab87dd 100755
--- a/t/txinfo29.sh
+++ b/t/txinfo29.sh
@@ -34,7 +34,7 @@ grep 'overrides Automake variable.*INFO_DEPS' stderr
 $AUTOMAKE -Wno-override
 
 # There is only one definition of INFO_DEPS ...
-test 1 = `grep '^INFO_DEPS.*=' Makefile.in | wc -l`
+test 1 -eq $(grep -c '^INFO_DEPS.*=' Makefile.in)
 # ... and it is the right one.
 grep '^INFO_DEPS *= *foo.info *$' Makefile.in
 
@@ -55,7 +55,7 @@ grep 'overrides Automake variable.*INFO_DEPS' stderr
 $AUTOMAKE -Wno-override
 
 # There is only one definition of INFO_DEPS ...
-test 1 = `grep '^INFO_DEPS.*=' Makefile.in | wc -l`
+test 1 -eq $(grep -c '^INFO_DEPS.*=' Makefile.in)
 # ... and it is the right one.
 grep '^INFO_DEPS *= address@hidden@ *$' Makefile.in
 
diff --git a/t/txinfo30.sh b/t/txinfo30.sh
index 09ebd5e..1766cac 100755
--- a/t/txinfo30.sh
+++ b/t/txinfo30.sh
@@ -39,7 +39,7 @@ EOF
 
 chmod +x makeinfo
 
-PATH=`pwd`$PATH_SEPARATOR$PATH
+PATH=$(pwd)$PATH_SEPARATOR$PATH
 export PATH
 
 # Otherwise configure might pick up a working makeinfo from the
diff --git a/t/txinfo32.sh b/t/txinfo32.sh
index 7fa7938..6f0c5a3 100755
--- a/t/txinfo32.sh
+++ b/t/txinfo32.sh
@@ -32,9 +32,9 @@ END
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
-./configure "--prefix=`pwd`/inst"
+./configure --prefix="$(pwd)/inst"
 $MAKE html dvi ps pdf info \
       install-html install-dvi install-ps install-pdf install-info \
       install-man install-data install-exec install uninstall
 
-Exit 0
+:
diff --git a/t/txinfo9.sh b/t/txinfo9.sh
index eb2cbdc..6d9c28b 100755
--- a/t/txinfo9.sh
+++ b/t/txinfo9.sh
@@ -35,7 +35,7 @@ $AUTOMAKE
 # overkill.
 for t in info dist-info dvi-am install-html uninstall-pdf-am; do
   $EGREP "(^| )$t*.:" Makefile.in # For debugging.
-  test `$EGREP -c "(^| )$t(:| *.:)" Makefile.in` -eq 1
+  test $($EGREP -c "(^| )$t(:| *.:)" Makefile.in) -eq 1
 done
 
 :
diff --git a/t/uninstall-fail.sh b/t/uninstall-fail.sh
index aee1fb5..7eac342 100755
--- a/t/uninstall-fail.sh
+++ b/t/uninstall-fail.sh
@@ -53,9 +53,10 @@ $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
 
+# Make it harder to experience false postives when grepping error messages.
 inst=__inst-dir__
 
-./configure --prefix="`pwd`/$inst"
+./configure --prefix="$(pwd)/$inst"
 
 mkdir $inst $inst/share
 : > $inst/share/foobar.txt
diff --git a/t/uninstall-pr9578.sh b/t/uninstall-pr9578.sh
index 1ba6ac7..1be2a26 100755
--- a/t/uninstall-pr9578.sh
+++ b/t/uninstall-pr9578.sh
@@ -40,7 +40,7 @@ $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
 
-./configure --prefix="`pwd`/inst"
+./configure --prefix="$(pwd)/inst"
 
 $MAKE uninstall
 test ! -d inst
diff --git a/t/vala-mix.sh b/t/vala-mix.sh
index 7e04b60..c353aab 100755
--- a/t/vala-mix.sh
+++ b/t/vala-mix.sh
@@ -36,7 +36,7 @@ mu_CFLAGS = -DHAVE_MU
 baz_SOURCES = baz.c
 END
 
-if cross_compiling; then :; else
+if ! cross_compiling; then
   unindent >> Makefile.am <<'END'
     check-local:
        ./zardoz
diff --git a/t/vala-vapi.sh b/t/vala-vapi.sh
index 3a92716..637e73a 100755
--- a/t/vala-vapi.sh
+++ b/t/vala-vapi.sh
@@ -47,7 +47,7 @@ cat > foo.vapi <<'END'
 public const string BARBAR;
 END
 
-if cross_compiling; then :; else
+if ! cross_compiling; then
   unindent >> Makefile.am <<'END'
     check-local: test2
     .PHONY: test1 test2
diff --git a/t/vala.sh b/t/vala.sh
index 71c2ee6..cc50ff1 100755
--- a/t/vala.sh
+++ b/t/vala.sh
@@ -65,7 +65,7 @@ $FGREP 'am_zardoz_OBJECTS' Makefile.in
 $FGREP 'am_libzardoz_la_OBJECTS' Makefile.in
 $FGREP 'zardoz_vala.stamp:' Makefile.in
 $FGREP 'libzardoz_la_vala.stamp:' Makefile.in
-test `$FGREP -c '.stamp:' Makefile.in` -eq 2
+test $($FGREP -c '.stamp:' Makefile.in) -eq 2
 $FGREP 'zardoz.c' Makefile.in
 $FGREP 'zardoz-foo.c' Makefile.in
 $FGREP 'zardoz-bar.c' Makefile.in
@@ -76,7 +76,7 @@ $FGREP 'am_foo_OBJECTS' sub/Makefile.in
 $FGREP 'bar.c' sub/Makefile.in
 $FGREP 'baz.c' sub/Makefile.in
 $FGREP 'foo_vala.stamp:' sub/Makefile.in
-test `$FGREP -c '.stamp:' sub/Makefile.in` -eq 1
+test $($FGREP -c '.stamp:' sub/Makefile.in) -eq 1
 
 # Check against regression for weird bug due to unescaped '@'
 # characters used in a "..." perl string when writing the vala
diff --git a/t/vala4.sh b/t/vala4.sh
index 879803f..2d3951a 100755
--- a/t/vala4.sh
+++ b/t/vala4.sh
@@ -35,10 +35,7 @@ exit 0
 END
 chmod +x valac
 
-cwd=`pwd`
-
-# Use $cwd instead of `pwd` in the && list below to avoid a bug in
-# the way Solaris/Heirloom Sh handles 'set -e'.
+cwd=$(pwd) || fatal_ "getting current working directory"
 
 $ACLOCAL
 $AUTOMAKE -a
diff --git a/t/vala5.sh b/t/vala5.sh
index 6ea2738..1943b86 100755
--- a/t/vala5.sh
+++ b/t/vala5.sh
@@ -73,11 +73,11 @@ grep PKG_CHECK_MODULES configure && skip_ "pkg-config m4 
macros not found"
 ./configure
 $MAKE
 
-if cross_compiling; then :; else
+if ! cross_compiling; then
   ./src/foo
   ./src/bar
-  test `./src/foo` = foo
-  test `./src/bar` = bar
+  test "$(./src/foo)" = foo
+  test "$(./src/bar)" = bar
 fi
 
 # Test clean rules.
diff --git a/t/vartypo2.sh b/t/vartypo2.sh
index 9b52df6..cc9f4dd 100755
--- a/t/vartypo2.sh
+++ b/t/vartypo2.sh
@@ -53,9 +53,8 @@ AUTOMAKE_fails --add-missing
 # Makefile.am:5: warning: variable `libfoo_la_DEPENDENCIES' is defined but no 
program or
 # Makefile.am:5: library has `libfoo_la' as canonical name (possible typo)
 
-
 grep 'as canonical' stderr | grep -v ' .libfoo_la. ' && Exit 1
-test `grep 'variable.*is defined but' stderr | wc -l` = 6
+test $(grep -c 'variable.*is defined but' stderr) -eq 6
 
 # If we add a global -Wnone, all warnings should disappear.
 $AUTOMAKE -Wnone
diff --git a/t/vartypos.sh b/t/vartypos.sh
index eb924cc..c323fff 100755
--- a/t/vartypos.sh
+++ b/t/vartypos.sh
@@ -73,7 +73,7 @@ AUTOMAKE_fails -Wno-extra-portability
 
 grep 'as canonical' stderr | grep -v ' .foo. ' | grep -v ' .libfoo_a. ' \
   && Exit 1
-test `grep 'variable.*is defined but' stderr | wc -l` = 13
+test $(grep -c 'variable.*is defined but' stderr) -eq 13
 
 # If we add a global -Wnone, all warnings should disappear.
 $AUTOMAKE -Wnone
diff --git a/t/version6.sh b/t/version6.sh
index 1c04ab4..8d33c44 100755
--- a/t/version6.sh
+++ b/t/version6.sh
@@ -18,7 +18,7 @@
 
 . ./defs || Exit 1
 
-amver=`$AUTOMAKE --version | sed -e 's/.* //;1q'`
+amver=$($AUTOMAKE --version | sed -e 's/.* //;1q')
 
 # Does the extracted version number seems legit?
 case $amver in
diff --git a/t/vtexi3.sh b/t/vtexi3.sh
index 9dd3e67..5bea281 100755
--- a/t/vtexi3.sh
+++ b/t/vtexi3.sh
@@ -91,7 +91,7 @@ do_check ()
   # Check that UPDATED seems right, and that UPDATED and UPDATED-MONTH
   # are consistent.
   $EGREP "address@hidden UPDATED $date$" $srcdir/$vfile.texi
-  vmonth=`grep 'address@hidden UPDATED ' $srcdir/$vfile.texi | awk '{print $4, 
$5}'`
+  vmonth=$(grep 'address@hidden UPDATED ' $srcdir/$vfile.texi | awk '{print 
$4, $5}')
   grep "address@hidden UPDATED-MONTH $vmonth$" $srcdir/$vfile.texi
   # Check that the vers*.texi file is distributed according
   # to $(DISTFILES).
diff --git a/t/vtexi4.sh b/t/vtexi4.sh
index bba1b5a..ee9d078 100755
--- a/t/vtexi4.sh
+++ b/t/vtexi4.sh
@@ -24,16 +24,12 @@
 required='makeinfo tex texi2dvi'
 . ./defs || Exit 1
 
-case `LC_ALL=C date '+%u'` in
-  [1-7]) date_is_posix=:;;
-      *) date_is_posx=false;;
-esac
-$date_is_posix \
-  && day=`LC_ALL=C date '+%d'` && test -n "$day" \
-  && month=`LC_ALL=C date '+%B'` && test -n "$month" \
-  && year=`LC_ALL=C date '+%Y'`&& test -n "$year" \
+test $(LC_ALL=C date '+%u') -gt 0 && test $(LC_ALL=C date '+%u') -lt 8 \
+  && day=$(LC_ALL=C date '+%d')   && test -n "$day" \
+  && month=$(LC_ALL=C date '+%B') && test -n "$month" \
+  && year=$(LC_ALL=C date '+%Y')  && test -n "$year" \
   || skip_ "'date' is not POSIX-compliant enough"
-day=`echo "$day" | sed 's/^0//'`
+day=$(echo "$day" | sed 's/^0//')
 
 (echo 'x' | grep x) \
   || skip_ "grep doesn't work on input that is not pure text"
diff --git a/t/warnings-win-over-strictness.sh 
b/t/warnings-win-over-strictness.sh
index 5d47f50..d0af924 100755
--- a/t/warnings-win-over-strictness.sh
+++ b/t/warnings-win-over-strictness.sh
@@ -32,7 +32,7 @@ ko ()
 {
   AUTOMAKE_run $*
   grep '^Makefile\.am:.*:=.*not portable' stderr
-  test `wc -l <stderr` -eq 1
+  test $(wc -l <stderr) -eq 1
 }
 
 set_am_opts()
diff --git a/t/warnopts.sh b/t/warnopts.sh
index 1662d91..584f864 100755
--- a/t/warnopts.sh
+++ b/t/warnopts.sh
@@ -52,7 +52,7 @@ grep '^sub/Makefile.am:.*INCLUDES' stderr
 grep '^sub/Makefile.am:.*foo_SOURCES' stderr && Exit 1
 grep '^Makefile.am:.*INCLUDES' stderr && Exit 1
 # Only three lines of warnings.
-test `grep -v 'warnings are treated as errors' stderr | wc -l` = 3
+test $(grep -v 'warnings are treated as errors' stderr | wc -l) -eq 3
 
 # On fast machines the autom4te.cache created during the above run of
 # $AUTOMAKE is likely to have the same time stamp as the configure.ac
@@ -71,3 +71,5 @@ AC_OUTPUT
 END
 $ACLOCAL
 $AUTOMAKE
+
+:
diff --git a/t/werror4.sh b/t/werror4.sh
index b2f3f6a..9a9a166 100755
--- a/t/werror4.sh
+++ b/t/werror4.sh
@@ -40,7 +40,7 @@ $ACLOCAL
 AUTOMAKE_fails -Wno-error
 grep 'VAR multiply defined' stderr
 grep 'SUB multiply defined' stderr
-test `grep -c 'warnings are treated as errors' stderr` -eq 1
+test $(grep -c 'warnings are treated as errors' stderr) -eq 1
 
 sed '/AUTOMAKE_OPTIONS/d' sub/Makefile.am > t
 mv -f t sub/Makefile.am
@@ -48,7 +48,7 @@ mv -f t sub/Makefile.am
 AUTOMAKE_fails -Wno-error
 grep 'VAR multiply defined' stderr
 grep 'SUB multiply defined' stderr
-test `grep -c 'warnings are treated as errors' stderr` -eq 1
+test $(grep -c 'warnings are treated as errors' stderr) -eq 1
 
 sed '/AUTOMAKE_OPTIONS/d' Makefile.am > t
 mv -f t Makefile.am
@@ -56,7 +56,7 @@ mv -f t Makefile.am
 AUTOMAKE_fails -Werror
 grep 'VAR multiply defined' stderr
 grep 'SUB multiply defined' stderr
-test `grep -c 'warnings are treated as errors' stderr` -eq 1
+test $(grep -c 'warnings are treated as errors' stderr) -eq 1
 
 AUTOMAKE_run -Wno-error
 grep 'VAR multiply defined' stderr
diff --git a/t/yacc-basic.sh b/t/yacc-basic.sh
index d2fd490..34c7565 100755
--- a/t/yacc-basic.sh
+++ b/t/yacc-basic.sh
@@ -67,7 +67,7 @@ test -f bar-parse.c
 # Check that per-object flags are honored.
 test -f bar-parse.output
 
-if cross_compiling; then :; else
+if ! cross_compiling; then
   echo a | ./foo
   echo b | ./foo && Exit 1
   echo a | ./bar
diff --git a/t/yacc-cxx.sh b/t/yacc-cxx.sh
index 41a25ec..94e5dad 100755
--- a/t/yacc-cxx.sh
+++ b/t/yacc-cxx.sh
@@ -89,7 +89,7 @@ test -f foo4-parse4.cpp
 test -f foo3-parse3.output
 test -f foo4-parse4.output
 
-if cross_compiling; then :; else
+if ! cross_compiling; then
   for i in 1 2 3 4; do
     echo a | ./foo$i
     echo b | ./foo$i && Exit 1
diff --git a/t/yacc-depend2.sh b/t/yacc-depend2.sh
index df48a0b..5d9aa38 100755
--- a/t/yacc-depend2.sh
+++ b/t/yacc-depend2.sh
@@ -32,14 +32,11 @@ bin_PROGRAMS = foo
 AM_YFLAGS = -d
 foo_SOURCES = foo.y main.c
 BUILT_SOURCES = foo.h
-.PHONY: debug-info test-time-unchanged test-time-changed
-debug-info:
-       ls -l
-       stat *.[ch] *.$(OBJEXT) my-timestamp || :
-test-time-unchanged: debug-info
-       test `ls -1t main.$(OBJEXT) my-timestamp | sed 1q` = my-timestamp
-test-time-changed: debug-info
-       test `ls -1t main.$(OBJEXT) my-timestamp | sed 1q` = main.$(OBJEXT)
+.PHONY: test-time-unchanged test-time-changed
+test-time-unchanged:
+       is_newest foo.y foo.h main.$(OBJEXT)
+test-time-changed:
+       is_newest main.$(OBJEXT) foo.y foo.h
 END
 
 cat > foo.y << 'END'
@@ -72,8 +69,6 @@ $MAKE
 ls -l # For debugging.
 
 $sleep
-: > my-timestamp
-$sleep
 touch foo.y
 $MAKE
 $MAKE test-time-unchanged
diff --git a/t/yacc-dist-nobuild.sh b/t/yacc-dist-nobuild.sh
index 6f02f11..52abb87 100755
--- a/t/yacc-dist-nobuild.sh
+++ b/t/yacc-dist-nobuild.sh
@@ -65,7 +65,7 @@ exit 1
 END
 cp bin/yacc bin/bison
 chmod a+x bin/yacc bin/bison
-PATH=`pwd`/bin$PATH_SEPARATOR$PATH
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH
 
 YACC=yacc BISON=bison
 export YACC BISON
diff --git a/t/yacc-pr204.sh b/t/yacc-pr204.sh
index 6507b51..f1c8cac 100755
--- a/t/yacc-pr204.sh
+++ b/t/yacc-pr204.sh
@@ -77,8 +77,7 @@ $sleep
 touch parse.y parse2.y
 $sleep
 $MAKE parse.c parse2.c
-stat parse.c parse.y parse2.c parse2.y || : # For debugging.
-test `ls -t parse.c parse.y | sed 1q` = parse.c
-test `ls -t parse2.c parse2.y | sed 1q` = parse2.c
+is_newest parse.c parse.y
+is_newest parse2.c parse2.y
 
 :
diff --git a/t/yacc8.sh b/t/yacc8.sh
index bab627d..6640d32 100755
--- a/t/yacc8.sh
+++ b/t/yacc8.sh
@@ -75,16 +75,14 @@ test -f foo/parse.h
 
 # Make sure foo/parse.h is not updated, unless when needed.
 $sleep
-: > z
-$sleep
 touch ../foo/parse.y
 $MAKE obj
-test `ls -1t foo/parse.h z | sed 1q` = z
+is_newest ../foo/parse.y foo/parse.h
 $sleep
 sed 's/%%/%token TOKEN\n%%/g' ../foo/parse.y >../foo/parse.yt
 mv -f ../foo/parse.yt ../foo/parse.y
 $MAKE obj
-test `ls -1t foo/parse.h z | sed 1q` = foo/parse.h
+is_newest foo/parse.h ../foo/parse.y
 
 # Now, adds another parser to test ylwrap.
 
diff --git a/t/yflags-force-conditional.sh b/t/yflags-force-conditional.sh
index 53038a8..8a98903 100755
--- a/t/yflags-force-conditional.sh
+++ b/t/yflags-force-conditional.sh
@@ -33,7 +33,7 @@ echo "/* $* */" > y.tab.c
 echo 'extern int dummy;' >> y.tab.c
 END
 chmod a+x bin/fake-yacc
-PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
 YACC=fake-yacc; export YACC
 
 cat > Makefile.am <<'END'


hooks/post-receive
-- 
GNU Automake



reply via email to

[Prev in Thread] Current Thread [Next in Thread]