claude-home/patterns/bash/README.md
Cal Corum 2bfbc7bb77 CLAUDE: Initialize efficient documentation system for home lab
- Created structured documentation with /patterns/, /examples/, and /reference/ directories
- Implemented automatic context loading rules in CLAUDE.md based on file extensions, directories, and keywords
- Added technology-specific patterns for Docker, Python, Node.js, Vue.js, Bash, networking, databases, and VM management
- Included complete working examples for common workflows and troubleshooting references
- Designed for minimal context usage with precise loading triggers

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 19:59:29 -05:00

1021 B

Bash Scripting Patterns

Script Structure

  • Use proper shebang (#!/bin/bash)
  • Set error handling (set -euo pipefail)
  • Include help/usage functions
  • Implement proper argument parsing

Best Practices

  • Input validation before processing
  • Logging and error messages to stderr
  • Exit codes for script status
  • Function-based organization for reusability

Common Patterns

  • Service management with systemd integration
  • Backup scripts with rotation and compression
  • Deployment automation with rollback capabilities
  • System monitoring with alerting

Security Considerations

  • Avoid hardcoded credentials
  • Use proper file permissions
  • Sanitize user inputs
  • Quote variables to prevent word splitting
  • Examples: /examples/bash/service-management.md
  • Examples: /examples/bash/backup-scripts.md
  • Examples: /examples/bash/deployment-automation.md
  • Reference: /reference/bash/troubleshooting.md
  • Reference: /reference/bash/security.md