linux_bash_script_generator
Assemble runnable bash shell scripts from structured options: choose shebang, strict mode, command-line arguments, and reusable blocks like check-root or retry-loop. Returns script text only, never executes.
Instructions
Bash Shell Script Generator. Build a runnable shell script (bash, sh, or zsh) from structured options - it ASSEMBLES and returns script TEXT, it never executes, saves, or runs anything. Pick a shebang and optional strict mode (set -euo pipefail, IFS), declare command-line args (short/long flags with types) that become a getopts-style case parser, and toggle reusable blocks: check-root, check-deps, log-setup, tmpdir (mktemp), trap-cleanup, usage-function, retry-loop, parallel, lock-file (flock), check-internet, and free-form custom blocks; customBody appends your own logic. Operation presets returns 11 ready-made templates (server backup, log rotation, deploy-via-ssh, db backup, rsync, health check, cert renewal, docker restart, git pre-commit, system cleanup). Use linux_systemd_unit_generator for service/timer unit files, linux_cron for crontab schedule lines, and linux_ssh_config_generator for ssh client config - this tool emits the executable script itself. Runs locally: read-only, non-destructive, no netwo
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | No | generate builds a script from the options below; presets ignores them and returns the 11 built-in templates. | generate |
| shebang | No | Interpreter line. Anything else falls back to bash. Choosing /bin/sh downgrades strict mode to set -eu and warns on bash-only blocks. | #!/bin/bash |
| strictMode | No | Emit strict-mode safety flags (set -euo pipefail and IFS). Disabling adds warnings about silent failures. | |
| name | No | Optional script name placed in the header comment. | |
| description | No | Optional multi-line description placed in the header comment. | |
| args | No | Command-line options to parse. Each becomes an UPPER_SNAKE variable plus a case branch; required string/file/int args are validated after parsing. | |
| blocks | No | Reusable hardening/utility sections to include, emitted in a fixed safe order regardless of array order. | |
| customBody | No | Free-form shell appended as the main script body. Scanned for bash-only syntax when shebang is /bin/sh. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Whether the request succeeded. | |
| operation | No | The operation performed (generate or presets). | |
| result | No | For generate: the script payload. For presets: a presets array of templates. |