]> Cypherpunks repositories - gostls13.git/commit
make.bash: use [[ rather than [
authorDaniel Martí <mvdan@mvdan.cc>
Sat, 30 Sep 2023 08:57:36 +0000 (09:57 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Tue, 3 Oct 2023 06:40:46 +0000 (06:40 +0000)
commit352c8835e7609ad72872b5a63bffeb6142b29d98
treed81bd3d557e8004722827acf130a5f29d8fba531
parent122b35e838af8ab9c0d5027741d6f73cef09f966
make.bash: use [[ rather than [

[[ is a compound command part of the language with structure,
whereas [ is simply a standard program with string arguments.
The former has a few significant advantages over the latter:

* Better syntax, e.g. && and || rather than -a and -o,
  as well as == rather than = for comparisons
* No need for fork+exec to evaluate each conditional
* Forgetting the closing token is an early parse error

The only advantage of [ over [[ is that [[ is Bash syntax,
whereas [ and "test" are portable POSIX Shell utilities.
However, this is a Bash script, so that is not a concern.

Change-Id: I8a4bdd16845bd67bf67a348d7d96d45d5b131d85
Reviewed-on: https://go-review.googlesource.com/c/go/+/531875
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/make.bash