The register, the door and the card reader keep their settings in ~/app/conf. Last week a bad update wiped
them, and nobody had a copy. Ana wants a backup script that can run every night:
learner@reef:~$ ./backup.sh ~/app/conf
Copied 3 filesYou have 10 minutes. The clock starts when you start the challenge. If the time runs out, you can still finish.
Everything you need is in this chapter and Linux Essentials. The tests run your script on other folders too, and each starts with no ~/backups: your script makes it. Make the script runnable with chmod u+x ~/backup.sh.
Objectives
./backup.sh DIRmakes~/backups/backup-DATE, whereDATEis whatdate +%Fwrites, and copies every.conffile ofDIRinto it, and only those. One name has a space.- It writes only how many files it copied:
Copied 3 files. - Given something that is not a directory, it writes a message as an error, copies nothing and fails with
exit 1.