shell-scripting

Enforce POSIX-compliant shell scripting with /bin/sh shebangs and set -e.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams write portable, POSIX-compliant shell scripts that work across environments, reducing maintenance and compatibility issues.

Core Features & Use Cases

  • POSIX compliance: Enforces standard syntax and avoids bash-specific features.
  • Safe scripting practices: Encourages set -e, proper quoting, and robust error handling.
  • Cross-system compatibility: Guides on shell choices, portability checks, and common pitfalls.
  • Use Case: You have a deployment script that must work on Linux and macOS without requiring Bash-specific extensions.

Quick Start

Start by applying the guidelines to your next shell script: ensure shebang is #!/bin/sh, enable set -e, and use [ -f "$file" ] tests for portability.

Frequently Asked Questions about shell-scripting

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

FAQPage Schema
How do I write a shell script that works on both Linux and macOS?▼

To write cross-platform shell scripts, use a /bin/sh shebang and avoid Bash-specific extensions. Enabling POSIX compliance ensures your deployment scripts run consistently across diverse environments like Linux and macOS without modification.

What is POSIX shell scripting and when do I need it?▼

POSIX shell scripting uses standard syntax to ensure portability across diverse environments. You need it when writing deployment or maintenance scripts that must run reliably on different Unix-like systems without relying on Bash-specific features or extensions.

How do I make my shell scripts handle errors safely?▼

To handle errors safely in shell scripts, enable set -e to exit on errors and apply proper quoting to variables. Robust error handling combined with portable test constructs like [ -f "$file" ] prevents unexpected failures during script execution.

Does my shell script need a specific shebang for cross-platform compatibility?▼

Yes, your shell script needs a /bin/sh shebang for cross-platform compatibility. Using #!/bin/sh enforces POSIX compliance and avoids Bash-specific features, ensuring the script executes properly across diverse environments and reducing maintenance issues.

What are common portability pitfalls when writing shell scripts?▼

Common portability pitfalls include using Bash-specific syntax, improper variable quoting, and non-portable test constructs. Avoiding these pitfalls by enforcing POSIX-compatible patterns and standard syntax ensures your scripts work seamlessly across different operating systems.

Why does my shell script fail on macOS but work on Linux?▼

Your shell script likely fails on macOS due to Bash-specific extensions or non-POSIX constructs. macOS uses a different default shell version; enforcing standard POSIX syntax, proper quoting, and portable test constructs ensures consistent execution across both platforms.