← ClaudeAtlas

bash-patternslisted

Bash and shell script patterns - safety flags, quoting, conditionals, traps, functions, ShellCheck discipline, and review-worthy anti-patterns. Use whenever the project contains `.sh`/`.bash`/`.zsh` files, files with a bash/sh shebang, scripts in `bin/`, shell dotfiles, or Makefile recipes, OR the user asks about shell scripting or a shell pipeline, even if "bash" is not mentioned by name.
ku5ic/dotfiles · ★ 0 · Data & Documents · score 72
Install: claude install-skill ku5ic/dotfiles
# Bash patterns - Default assumption: bash 5.x targeting macOS (via Homebrew bash) and Linux. - Scripts use `#!/usr/bin/env bash`, so the resolved binary is whatever is first on PATH -- on the user's machine that's the Homebrew 5.x build, not the stock macOS `/bin/bash` 3.2. - Anything that requires bash 4.0+ (case modification, `mapfile`, `${parameter@op}`) is unsafe under stock macOS bash; flagged here when the version cut matters. ## Reference files | File | Covers | | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | [reference/safety-flags.md](reference/safety-flags.md) | Script preamble, `set -euo pipefail` edge cases, `inherit_errexit`, `nullglob`, verification before shipping | | [reference/quoting.md](reference/quoting.md) | Quoting rules, nested quoting, heredoc indentation, `printf` over `echo`, zsh-vs-bash differences | | [reference/conditionals.md](reference/conditionals.md) | `[[ ]]` over `[ ]`, glob vs literal, numeric vs string comparison, `(( ))`, `case` | | [reference/functions-and-traps.md](reference/functions-and-traps.md) | Functions and locals, `trap` patterns, `BASH_LI