Overview
Create cross-shell scripts that are safe, idempotent, and clear in their output.
- Target shells (Bash, Zsh, or POSIX sh).
- OS constraints and required tools.
- Install locations and config files to modify.
- Whether the script should be non-interactive.
Workflow
- Confirm compatibility constraints.
- Prefer POSIX-compatible syntax when possible.
- Avoid arrays and bashisms unless explicitly allowed.
- Design idempotence and safety.
- Use
command -v for existence checks.
- Guard file edits with checks to avoid duplicate lines.
- Implement predictable output.
- Use clear status messages and exit codes.
- For reminder scripts, print literal reminders instead of executing commands.
- Handle installation steps.
- Prefer and explicit shell-config edits.