Add a Line Only Once
Provisioning scripts run again and again. Every run that blindly does echo "x" >> file adds another copy. Write /home/student/bin/ensure-line.sh FILE LINE.
FILE already contains LINE as a whole line (exactly, including any special characters), do nothing.LINE at the end. If the file doesn't end with a newline, add one first so the existing last line stays intact.FILE doesn't exist, create it containing just LINE.added or present, and exit 0.Lines may contain characters that mean something to regular expressions or the shell, like ., *, [, $, \ or a leading -.
About this machine
Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.
Teaching or writing about this? Embed this lab on your page
Your machine is ready to start
A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.
No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.