Questions tagged [bash]
Post a PromptPrompts that produce shell scripts and CLI tools.
3 prompts
19votes
1answers
2.7kviews
Getting the model to write actually safe bash instead of a footgun with set -e
I kept getting shell scripts that looked fine and then nuked a directory because an unset variable expanded to empty and rm -rf "$DIR/" became rm -rf /. Adding set -e alone is a trap: it silently does
10votes
3answers
2.0kviews
Prompt for an idempotent cron/systemd maintenance script that's safe to run twice
Our nightly cleanup job used to assume it ran exactly once and finished. Then a run overlapped with the next one, they both deleted the same temp files, and one crashed mid-way leaving a half-cleaned
12votes
1answers
1.4kviews
Prompt for a bulk file-rename CLI with a regex, a dry-run, and collision detection
Batch renaming is exactly the kind of task where a model gives you a confident three-liner that renames files in a loop and, halfway through, renames a.txt to b.txt on top of an existing b.txt, or ren