Every night, ~/nightly.sh copies the register log to ~/archive, then deletes it. Last night it deleted the log, and the archive got nothing.
- In
nano ~/nightly.sh, addset -euo pipefailunder the shebang. - Run
./nightly.sh. Read the line where it stops, fix that name, and run it again.
The tests also run it with no ~/archive, and with no register log: strict mode must stop it before it deletes the log or writes a wrong count.
Objectives
- It archives the log.
- When
~/archiveis missing, it stops and keeps the log. - When the log is missing, it stops before it writes to
lines.txt.