File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,8 +22,11 @@ Keep in mind this is not for general shell scripting, these are rules specifical
2222 * Always use ` local ` when setting variables, unless there is reason to use ` declare `
2323 * Exception being rare cases when you are intentionally setting a variable in an outer scope.
2424 * Variable names should be lowercase unless exported to environment.
25- * Always use ` set -eo pipefail ` . Fail fast and be aware of exit codes.
26- * Use ` || true ` on programs that you intentionally let exit non-zero.
25+ * Fail fast and be aware of exit codes
26+ * Always use ` set -uo pipefail ` (fail on unset variables, and fail if any command in a pipeline fails)
27+ * Consider also using ` set -e ` (terminate script on _ any_ non-zero exit), with an ERR trap
28+ * Use ` || true ` on programs that you intentionally let exit non-zero.
29+ * Use something like ` : ${arg:?Expected argument 'arg'} ` when you don't have time to do proper argument parsing
2730 * Never use deprecated style. Most notably:
2831 * Define functions as ` myfunc() { ... } ` , not ` function myfunc { ... } `
2932 * Always use ` [[ ` instead of ` [ ` or ` test `
You can’t perform that action at this time.
0 commit comments