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

Fill in the details

Describe the automation goal, steps, or workflow the script should perform.

Specify the target shell for the script. Leave blank for bash.

Specify the operating system or environment. Leave blank for cross-platform POSIX compatibility.

List any variables, file paths, API endpoints, or command-line arguments the script should handle.

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

  1. Fill in the fields above. Required ones are marked with *.
  2. Check the prompt preview: your answers appear highlighted in place.
  3. Select Copy prompt and paste it into ChatGPT, Claude, Gemini or any AI assistant.
See all Software Development & Coding prompts