aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2021-03-12 21:06:45 +0000
committerUlrich Müller <ulm@gentoo.org>2021-03-21 06:47:41 +0100
commit04d0b38c276a5eb47c7d9485a97dfd73ab5cbff4 (patch)
tree31da9620de9a78510ef172261b10f3c67699d2ca /tools-reference
parentdevbook-guide: Clearer section structure (diff)
downloaddevmanual-04d0b38c276a5eb47c7d9485a97dfd73ab5cbff4.tar.gz
devmanual-04d0b38c276a5eb47c7d9485a97dfd73ab5cbff4.tar.bz2
devmanual-04d0b38c276a5eb47c7d9485a97dfd73ab5cbff4.zip
tools-reference/bash: elaborate on why bash tests are preferred
Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'tools-reference')
-rw-r--r--tools-reference/bash/text.xml8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools-reference/bash/text.xml b/tools-reference/bash/text.xml
index 56608c4..821d385 100644
--- a/tools-reference/bash/text.xml
+++ b/tools-reference/bash/text.xml
@@ -120,6 +120,14 @@ all new code.
</important>
<p>
+POSIX compliance is not a concern for ebuilds, as their interpreter is
+guaranteed to be GNU Bash. POSIX style tests have different semantics and
+using the common forms of tests adheres to the principle of least surprise.
+Most developers will be used to Bash test semantics and behaviour and deviating
+from this in ebuilds may be confusing.
+</p>
+
+<p>
This is because <c>[[ ]]</c> is a bash syntax construct, whereas <c>[ ]</c> is a
program which happens to be implemented as an internal <d/> as such, cleaner
syntax is possible with the former. For a simple illustration, consider: