developing-bash

Automates defensive Bash and POSIX scripting across Linux, macOS, and other environments.

5|1|Updated Sep 6, 2009
One-click install
npx skills add https://github.com/bnadlerjr/dotfiles --skill developing-bash
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: developing-bash
Source: https://github.com/bnadlerjr/dotfiles/tree/main/claude/skills/developing-bash
Command: npx skills add https://github.com/bnadlerjr/dotfiles --skill developing-bash

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Script authors often struggle to write portable, reliable Bash and POSIX scripts, with insufficient safety and cross-platform handling.

Core Features & Use Cases

  • Provides defensive scripting patterns (set -euo pipefail, quotes, traps) and cross-platform considerations.
  • Guides on portability across macOS, Linux, and other POSIX environments, including shell option detection and POSIX sh usage.
  • Use case: refactor a brittle script to be safer, more portable, and easier to audit.

Quick Start

Generate a portable Bash snippet that demonstrates defensive scripting patterns for a given task.

Frequently Asked Questions about developing-bash

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a portable Bash script that works on macOS and Linux?

Defensive Bash scripting uses set -euo pipefail, proper quoting, and traps to handle errors and ensure scripts fail safely instead of continuing with unexpected states.

What is the best way to handle errors in POSIX shell scripts?

Error handling in POSIX shell scripts is best achieved using defensive patterns like traps, set -e, and consistent failure logic to catch issues early and prevent silent execution errors.

How do I refactor a brittle Bash script to be safer and easier to audit?

Refactoring brittle scripts involves applying defensive scripting patterns, adding strict error handling with traps, and verifying cross-platform portability to improve safety and auditability.

Does my Bash script need POSIX sh compatibility to run across different environments?

POSIX sh compatibility ensures your script runs across diverse environments by avoiding Bash-specific extensions, using shell option detection, and adhering to POSIX standards for maximum portability.

Why does my Bash script fail silently on macOS but work on Linux?

Cross-platform failures often stem from missing defensive flags like set -euo pipefail and differing shell option availability, requiring portability checks and POSIX compliance to resolve inconsistencies.