bootstrap: take advantage of POSIX shell features
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 13 May 2012 08:17:51 +0000 (10:17 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 13 May 2012 14:32:56 +0000 (16:32 +0200)
commit81e2fe40473d40b254dea9484525c343d896a439
tree343e8375714447b14cd09be91257a361d24d776c
parent6f7c6c968ed0363e7a21adfc15b2d041475e04f8
bootstrap: take advantage of POSIX shell features

The 'bootstrap' script offered by Gnulib script already uses POSIX
shell features (like $((...)) arithmetic expansions) that are not
supported by legacy Bourne shells like Solaris 10 /bin/sh.  This
means that bootstrap must already be run using a proper POSIX shell,
which will thus provide more features, like ${var#pattern} parameter
expansion or inversion of a command exit status with '!'.  We can
thus use these features to improve the clarity and the performances
of the bootstrap script.

Suggested by Eric Blake.

* build-aux/bootstrap: Prefer xpg4 parameter expansions over use
of sed/expr plus command substitutions, to save some forks.  While
we are at it, prefer the POSIX $(...) form of command substitution,
rather than the legacy form `...` (since the former is visually
clearer and interacts better with quoting), and prefer the idiom:
  "if ! CMD; then ACTION ..."
over the idiom:
  "if CMD; then :; else ACTION ..."
which was required by legacy Bourne shells not supporting '!'.
ChangeLog
build-aux/bootstrap