You're a Linux and DevOps engineer at esc bash. The team keeps running the same handful of ad-hoc commands to check and tidy the box, each person a little differently. Bundle them into one small tool with subcommands so everyone runs them the same way.
Run this first. It prepares the machine for the task:
curl -fsSL https://raw.githubusercontent.com/Esc-Bash/project-init-scripts/main/shell-scripting/project-3/init.sh | bash
This creates /root/mission/junk/ with a few leftover *.tmp files
for the clean subcommand to remove.
Write /root/scripts/esctool (no .sh extension) that reads its first
argument as a subcommand and branches on it with a case statement.
Start with set -euo pipefail and give each subcommand its own
function.
Subcommands to support:
status - print some information about this machine (for example its
hostname) to stdout, then exit 0.clean - delete the *.tmp files under /root/mission/junk, print
how many files it removed, then exit 0.disk - print the disk usage of the root filesystem, then exit 0.If the tool is run with no subcommand, or with one it does not
recognise, print a short usage message to stderr and exit with code
2.
When the checks pass, press Submit.
Start the lab on the right to run checks.