Writing Bash Scripts

Bash script style guide. Always use when writing bash scripts, shell scripts, or CLI bash tools. Use when this capability is needed.

tomevault-io Updated

File contents

Bash Script Style Guide

  • Use #!/usr/bin/env bash as shebang
  • Always use set -euo pipefail for safety
  • Keep scripts minimal: no unnecessary comments or echoes
  • Minimal input validation; print usage to stderr and exit if inputs are missing/invalid
  • Don't check for installed commands if failure is obvious on use
  • Make script executable: chmod +x <script>
  • Prefer concise, direct logic over verbosity

Converted and distributed by TomeVault — claim your Tome and manage your conversions.

tomevault-io/skills-registry/tree/main/lexler--skill-factory--writing-bash-scripts commit 8ca0836b77

Frequently asked questions

npx skillmds@latest add tomevault-io/writing-bash-scripts-2