language-bash
Installation
SKILL.md
Bash
Strict mode
set -euo pipefail
IFS=$'\n\t'
-eis suppressed in conditional contexts (||,&&,if,!); explicit subshells(...)do inherit it — use|| trueto absorb expected failures.-utreats unset variables as errors; unset arrays trigger it: declare before use (arr=()) or guard with${arr[@]+"${arr[@]}"}for optional arrays.IFS=$'\n\t'prevents accidental word-splitting on spaces inforloops and command substitution.
Quoting and tests
- Always
"$var"— bare$vartriggers word splitting and glob expansion. 'literal'for fixed strings with no expansion needed.- Prefer
[[ ]]over[ ]: supports=~regex, no word splitting, lexical string comparison. $()over backticks: nestable, readable, no escaping required.