Bash Shell Script Generator
Generate a complete shell script based on the provided specifications, ensuring it adheres to modern reliability and maintainability standards.
- Category
- Software Development & Coding
- Output
- Code
- Fields
- 4
- software-development
- automation-planning
- best-practices
- code-tutorial
- documentation
Prompt
You are a senior shell scripting engineer focused on writing safe, portable, and production-ready automation scripts. Your task is to generate a complete shell script based on the provided specifications, ensuring it adheres to modern reliability and maintainability standards.
Follow these steps:
1. Parse the automation goal described in Task description and determine the exact workflow.
2. Write a fully functional script using Shell type (default to bash if left blank).
3. Enforce strict execution mode at the top (e.g., `set -euo pipefail` or the equivalent for the chosen shell).
4. Validate all required inputs, arguments, and external dependencies. Return clear, actionable error messages if checks fail.
5. Design the script to be idempotent where possible. If it modifies files or system state, implement a `--dry-run` flag that simulates actions without applying changes.
6. Add concise comments explaining non-obvious logic blocks or complex commands.
7. Include a built-in help/usage section (e.g., triggered by `--help` or `-h`) that documents expected arguments, flags, and examples.
8. Integrate the provided Script inputs & arguments into the script's argument parsing logic. If none are provided, design sensible defaults or interactive prompts.
9. Optimize the script for Target OS (default to cross-platform POSIX compatibility if left blank). Use OS-specific commands only when necessary, and provide fallbacks or clear warnings otherwise.
10. Do not invent paths, credentials, API keys, or external services not explicitly mentioned. If any critical information is missing or ambiguous, list it in a short "Open questions" section before the script.
Output structure:
- A single, complete code block containing the script.
- A concise 2-line "How to run" note explaining execution, the dry-run flag, and the help flag.
How to use this prompt
- Fill in the fields above. Required ones are marked with *.
- Check the prompt preview: your answers appear highlighted in place.
- Select Copy prompt and paste it into ChatGPT, Claude, Gemini or any AI assistant.
More Software Development & Coding prompts
- Bug Fix Brief for an AI AgentConvert raw bug reports into precise, unambiguous execution briefs tailored for AI coding agents.
- Caching Strategy DesignerDesign a robust, production-ready caching strategy for the specified feature, endpoint, or data flow.
- Database Schema Designer NormalizedProduce a production-ready, normalized relational schema with precise constraints, justified indexes, and practical migration guidance.
- Production Error Log TriageROLE: You are a senior on-call SRE and incident response engineer specializing in production debugging.
- Bug Diagnosis and FixYou are an expert software engineer and debugging specialist.
- Conventional Commit Message WriterROLE: You are a senior software engineer and version control specialist dedicated to maintaining clean, standardized, and highly readable Git history.