The backup script is a handful of decisions rather than a lot of code: build a filename from the date, create the destination safely, refuse to run twice on the same day, and report the outcome with a status code another program can read.
Each one is marked as you go, and the explanation arrives straight after, which is
the part worth reading.
4 questions, marked as you go.
Tasks
These need your own device. Run the command in Termux, then paste what it printed.
The marking looks at what the output means, so spacing, version numbers and
ordering do not matter. If you have not installed anything yet, the
lesson covers the setup.
Build and list a dated archive
This makes a small source folder, packs it into a dated archive the way the script does, then lists the archive back to confirm what went in. The date in the filename is today.
Run this in Termux
On your own device. Nothing on this page executes it. The command runs in
your terminal, and this box only reads what you paste back.
mkdir -p "$HOME/notes" "$HOME/backups"; printf 'call the plumber\n' > "$HOME/notes/todo.txt"; STAMP=$(date +%Y-%m-%d); ARCHIVE="$HOME/backups/notes-$STAMP.tar.gz"; tar -czf "$ARCHIVE" -C "$HOME/notes" .; echo "wrote $ARCHIVE"; tar -tzf "$ARCHIVE"
The listing prints one entry per line, and the first is the folder itself as a single dot.
the script reports the archive it wrote
the archive name carries a date stamp
the file from the source folder is inside the archive
the commands actually ran
What a good answer looks like
The first line is your own message naming the archive, and it should contain the date stamp in the form year-month-day followed by .tar.gz. After that comes the archive listing from tar -tzf, which shows a single dot for the folder and a line for todo.txt, the file you put inside. The entries are relative to the source folder, which is why they begin with a dot rather than the full path. If the listing is empty, tar did not run or the source folder was wrong.
Marking your own work
Both halves of this are checked in your browser, with no server involved, so nothing
stops you from pasting output you did not run. The tasks are written so that the
easiest way to pass one is to actually do it and read the result, which is the whole
intention.