Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1cp report.txt backup/ | Afor f in *.txt; do cp "$f" backup/; done | |
| 2chmod +x backup.sh | Bcp notes.txt backup/ mv draft.txt archive/ | |
| 3A script runs its commands in order, so a script can copy a file and then move another file | CThe script has no execute permission, so ./backup.sh fails with a permission denied error. Run chmod +x backup.sh first. | |
| 4A loop in a script repeats the same command for every file that matches a pattern | DCopies report.txt into the backup folder when this line of the script runs | |
| 5folder = backup cp a.txt $folder/ | ESpaces around the = in a variable assignment. The shell treats folder as a command, so the variable is never set. It should be folder=backup. | |
| 6cp a.txt backup/ ./backup.sh | FMakes the script file executable so it can be run as a program |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
shell script — A text file of shell commands, such as cp, mv or rm, that run in order each time the script is run, so file tasks like backups can be automated.#!/bin/bash
cp notes.txt backup/notes.txt#!/bin/bash
mv report.txt archive/report.txtDEST=backup
cp notes.txt "$DEST/notes.txt"for f in *.txt; do
cp "$f" backup/
donechmod +x backup.sh
./backup.sh