Rechercher

PythonReactSEOPDF
GitHub Skill

shell-scripting

Best practices for writing shell scripts. Use when writing bash, sh, zsh, or other shell code for automation, scripting, or command-line tasks.

hoelzro☆ 9 Étoiles du dépôt0 Forks du dépôt

Installation

Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.

Voir la source ↗Guides

Instructions

Shell Scripting

Best Practices

Favor Long Options

When writing shell scripts, prefer long options (e.g., --verbose) over short options (e.g., -v) for improved readability and maintainability.

Why long options?

  • Self-documenting: grep --ignore-case is clearer than grep -i
  • Easier maintenance: Future readers understand intent without checking man pages
  • Reduced errors: Less likely to misinterpret what a short flag does

Example:

# Good: Clear and self-documenting
find /var/log --name "*.log" --type f --mtime +30 --delete

# Avoid: Requires knowledge of what each flag means
find /var/log -name "*.log" -type f -mtime +30 -delete

Exception: Short options are acceptable for:

  • Extremely common commands where the short form is universally understood (e.g., ls -la)
  • Interactive terminal usage where brevity matters
  • Commands without long option equivalents

Exemples

Consultez les exemples du dépôt source.

Voir la source ↗

Historique source

Date d’indexation
2026-01-20
Mise à jour de l’index
2026-01-26
Branch
main

Les dates concernent ce répertoire. Consultez le dépôt pour l’historique du code.

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!