shell-scripting

Convert short options to long options in Bash, SH, and Zsh scripts.

9|Updated Apr 25, 2012
One-click install
npx skills add https://github.com/hoelzro/dotfiles --skill shell-scripting-hoelzro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shell-scripting
Source: https://github.com/hoelzro/dotfiles/tree/main/claude/skills/shell-style
Command: npx skills add https://github.com/hoelzro/dotfiles --skill shell-scripting-hoelzro

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Shell scripting is powerful but error-prone. This Skill provides guidance on best practices to write readable, maintainable, and robust shell scripts, reducing bugs and maintenance time.

Core Features & Use Cases

  • Favor Long Options: Use long options like --verbose for readability and maintainability.
  • Self-documenting Choices: Long options help future readers understand intent without checking man pages.
  • Exception Handling: Short options remain acceptable for extremely common commands or interactive use.

Quick Start

Provide a simple shell snippet that uses long options (e.g., --ignore-case) instead of short flags and explain why the change improves readability.

Frequently Asked Questions about shell-scripting

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

FAQPage Schema
Why should I use long options instead of short flags in shell scripts?

Long options like `--verbose` make shell scripts self-documenting and reduce misinterpretation. They clarify intent for future readers without requiring man page lookups, improving readability and maintainability across Bash, SH, and Zsh scripts used in automation, deployment, and system administration.

How do I write more readable shell scripts using long options?

Replace short flags with descriptive long options in your script commands. For example, use `grep --ignore-case` instead of `grep -i`. Document your usage patterns and accommodate exceptions only for extremely common commands or interactive usage where long-option equivalents don't exist.

What's the best way to improve shell script maintainability?

Favor long options to make your intent explicit and scripts self-explanatory. This practice reduces bugs and maintenance time by helping current and future readers understand what each command does without consulting documentation, especially important in complex automation pipelines and deployment workflows.

Can I use long options in all shell scripts and environments?

Long options work across Bash, SH, and Zsh for most commands in system administration, automation, and data-processing workflows. Keep short options only for extremely common commands, interactive use, or where long-option equivalents aren't available to maintain compatibility and readability.

When should I keep using short options in shell scripts?

Retain short options only in limited cases: extremely common commands where convention overrides clarity, interactive shell usage, or commands without long-option equivalents. For all other shell scripting contexts—automation, deployment, and maintenance-heavy scripts—long options enhance safety and reduce errors.