claude-home/development/bash-CONTEXT.md
Cal Corum 4b7eca8a46
All checks were successful
Reindex Knowledge Base / reindex (push) Successful in 3s
docs: add YAML frontmatter to all 151 markdown files
Adds title, description, type, domain, and tags frontmatter to every
doc for improved KB semantic search. The description field is prepended
to every search chunk, and domain/type/tags enable filtered queries.

Type values: context, guide, runbook, reference, troubleshooting
Domain values match directory structure (networking, docker, etc.)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 09:00:44 -05:00

1.3 KiB

title description type domain tags
Bash Scripting Patterns Bash scripting conventions for script structure, error handling, argument parsing, and security. Covers systemd integration, backup scripts, deployment automation, and monitoring. context development
bash
scripting
systemd
automation
shell

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