What problem does it solve?
This Skill unit enhances Bash scripting practices, ensuring that scripts are modern, secure, and lint-clean.
Core Features & Use Cases
- Modern Bash Scripting Guidelines: Encourages the use of features like
set -Eeuo pipefail, shopt -s inherit_errexit, and shopt -s nullglob.
- Error Handling & Cleanup: Outlines standard
die() function and trap pair for resource cleanup and error handling.
- Variables & Quoting: Emphasizes strict variable quoting and
local declaration for function-scoped variables.
- Control Flow: Recommends using
[[ ]] over [ ], (( )) over expr, and case statements for string dispatch.
- Security: Discusses avoiding
eval, protecting against command injection, and performing atomic writes.
- Project Layout: Provides best practices for organizing project files in
bin/, lib/, and test/ directories.
- Tooling: Recommends using shellcheck, shfmt, bats-core, and shellharden for script analysis, formatting, and testing.
Quick Start
Install and update your Bash scripting skill by running 'source /path/to/bash/skill.sh' and then follow the guidelines within.