path: root/HACKING
diff options
authorLuke Shumaker <>2018-08-29 12:36:45 -0400
committerLuke Shumaker <>2018-08-29 12:36:45 -0400
commit1569bb18ae9071dd56142f226a807783305309ab (patch)
treef13751099a5b11403388938364d45ba3826365a6 /HACKING
parent3ff5d7ac010562c2a9d8d7a6bbcb8105485bacd1 (diff)
Rely on Bash 4.4 empty array behavior
Diffstat (limited to 'HACKING')
1 files changed, 1 insertions, 10 deletions
diff --git a/HACKING/ b/HACKING/
index f296621..06f301d 100644
--- a/HACKING/
+++ b/HACKING/
@@ -43,15 +43,6 @@ checked because of it.
Use `set -u` if you can; it makes using an unset variable an error.
- If a variable not being set is valid (perhaps a configuration
option), use `${var:-}` when accessing it to suppress the error.
- - An empty array counts as unset, so if you have an array that may be
- empty, use `${var+"${var[@]}"}` (don't put quotes around the outer
- pair of braces) to only access it if it's non-empty.
- - The reason for this is that a normal string variable is basically
- an array with length=1; an unset variable looks like an array
- with length=0. Weird stuff.
- - Actually, that was only true in Bash <4.4; but since the change
- wasn't mentioned in the NEWS, I suspect that a subsequent version
- will revert to the pre-4.4 behavior.
In the shebang, use `#!/usr/bin/env bash`. This allows us to not
hardcode the location of bash (I'm not sure why this is useful for
@@ -85,7 +76,7 @@ guidelines
They're pretty good, and cover most of the "gotcha's" about Bash
syntax. Though, it mentions but discourages the use of Bash 3
features... why? Who still uses Bash 2? For libretools, you should
-feel free to use Bash 4 features!
+feel free to use Bash 4.4 features!
I wrote an article on Bash arrays
<>. A lot of people think