shell-scripting

Enforce pipefail, nounset, and safe heredoc quoting in Bash scripts.

Updated Feb 28, 2026
One-click install
npx skills add https://github.com/IMBurbank/ganttlet --skill shell-scripting-imburbank
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shell-scripting
Source: https://github.com/IMBurbank/ganttlet/tree/main/.claude/skills/shell-scripting
Command: npx skills add https://github.com/IMBurbank/ganttlet --skill shell-scripting-imburbank

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers write robust Bash scripts by clarifying common pitfalls and best practices around pipe behavior, quotes, and error handling.

Core Features & Use Cases

  • Pipe Exit Codes: Understand how exit codes propagate in pipelines and how to capture the correct status for downstream commands.
  • Heredoc Quoting: Choose appropriate quoting in heredocs to prevent unintended variable expansion and to preserve runtime behavior.
  • set Flags and Error Handling: Encourage enabling safe shell options like set -euo pipefail and provide patterns for error detection and recovery.
  • Debugging & Testing Guidelines: Provide practical tips for testing, linting, and incremental verification of scripts.

Quick Start

Apply these foundational shell scripting guidelines to improve your existing scripts.

Frequently Asked Questions about shell-scripting

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

FAQPage Schema
How do I handle exit codes in a Bash pipeline so downstream commands fail correctly?

To handle exit codes in a Bash pipeline, enable the pipefail shell option. This ensures the pipeline returns the exit status of the last command that failed, preventing silent errors in automation scripts.

What is the best way to quote heredocs in Bash to prevent unintended variable expansion?

The best way to quote heredocs in Bash is to use appropriate quoting on the delimiter. Quoting the delimiter prevents unintended variable expansion and preserves runtime behavior, ensuring safe script execution.

How do I set strict error handling options in shell scripting?

To set strict error handling in shell scripting, apply safe options like set -euo pipefail. Encouraging these flags enables proper nounset and error detection, providing reliable patterns for error recovery in Bash scripts.

Why does my Bash script continue running after a command fails?

Your Bash script continues running after a command fails because strict error handling is not enabled. Applying the set -e flag ensures the script exits immediately when a command returns a non-zero status, enforcing robust execution.

What guidelines should I follow for testing and linting Bash scripts?

For testing and linting Bash scripts, follow practical guidelines for incremental verification and linting. Applying these testing tips helps identify syntax errors and ensures thorough verification of reliable pipelines in development.