Back to Collection
GPT-4o / Claude
verified safe

Shell Automation Task Runner

By SR Prompts Board
June 5, 2026
4 min read
Shell Automation Task Runner

Terminal Blueprint & Commands

Prompt Workbench

Select a tool tab to optimize prompt configurations automatically.

// Active target: ChatGPTUTF-8
Act as a Senior DevOps Engineer. Task: Write a comprehensive shell automation script (Bash/PowerShell) based on the user's specification. Operational Guidelines: 1. Add colored log indicators (e.g. green for Success, yellow for Warning, red for Error). 2. Implement sanity checks (e.g. verify directories exist, check if required CLI commands like tar, zip, rsync, or aws are installed). 3. Include a rollback routine if crucial operations fail. 4. Write clean configuration variables at the top of the script for easy tuning. 5. Include verbose logging that writes output to both stdout and a rolling file in `/var/log` or equivalent. 6. Return ONLY the code in a single markdown block. Automation Goal: [insert automation details, e.g., 'Compress a web folder, sync it to an AWS S3 bucket, and delete archives older than 14 days']
Presets:

How to use with ChatGPT

Step 1: Setup Workspace

Navigate to chatgpt.com. Select the GPT-4o model option from the dropdown menu in the upper left corner to support reasoning.

Step 2: Paste & Formulate

Paste the copied prompt from above directly into the chat input bar. Customize placeholder text brackets (e.g. `[Subject]`) with your own inputs.

Step 3: Refine Results

If the output needs adjustments, follow up with feedback like: "Add more details on feature X" or "Make the tone slightly more formal".

Pro Tip for ChatGPT:ChatGPT responds best to roleplay constraints. If you customize the prompt, you can add: 'Adopt the style of Steve Jobs' at the beginning to force a specific formatting aesthetic and presentation style.
Advertisement

Editorial Insight

This prompt instructs the AI to generate stable, self-verifying Bash or PowerShell scripts for automating system administrative tasks, backups, and deployments.

Generates a clean, modular Bash or PowerShell script to automate folder backups, clean up old logs, synchronize cloud folders, and send system alerts.

Calibrated Model Settings

Recommended EngineGPT-4o / Claude
Aspect Parameter16:9
Temperature Values0.2 (deterministic coding) to 0.7 (creative scripting)
Token Length Limits2048 to 4096 tokens
Formatting DirectivesClean markdown formatted output code blocks

Expected Result Output

#!/bin/bash # Shell Task Automation Snapshot LOG_FILE="/var/log/backup_runner.log" SRC_DIR="/var/www/html" DEST_DIR="/backup" if [ ! -d "$SRC_DIR" ]; then echo -e "\e[31m[ERROR]\e[0m Source directory $SRC_DIR does not exist." | tee -a "$LOG_FILE" exit 1 fi

Workflow Use Cases

Server BackupsAutomated nightly snapshots and compression of core databases.
CI/CD Pipeline TasksClean up local docker images, run migrations, and rebuild node packages.
File CleanupsScan directory trees to purge temporary assets or log files older than a month.

💡 Creator Tips & Variations

  • Webhooks Integration: Add a curl post command at the end of the script to push alerts directly to Slack or Discord channels.
  • Windows Compat: Specify PowerShell Core (.ps1) style scripting if you are targeting Windows Server environments.
  • Cron Schedule: Request a cron tab string expression matching your desired automation schedule (e.g. every Monday at 2 AM).

⚠️ Pitfalls & Mistakes to Avoid

  • Leaving brackets empty without filling in your custom variables (e.g., submitting '[insert topic]' directly to the model).
  • Not enforcing formatting limits, allowing the AI to generate long conversational intros and outros instead of clean, copyable code.
Advertisement

FAQ & Help

Q. Which AI model works best with this text template?

This prompt is optimized for advanced reasoning models like GPT-4o, Claude 3.5 Sonnet, and Gemini 1.5 Pro. It also works with smaller local models like Llama 3 but requires clear constraint enforcement.

Q. How do I prevent the model from generating conversational text?

Add a system rule: 'Do not write any introductory or concluding text. Return ONLY the raw formatted output.'

Explore Other Templates

Home
Prompts
Articles
Upcoming
About