Edit a file and make a repeatable task
By the end: Save a text file confidently and explain how a small build recipe works.
The idea
Start with one editor you can exit comfortably. Keep commands and output separate in your notes. A Makefile describes targets, prerequisites, and recipes; recipes normally begin with a real tab, not spaces. Read any downloaded Makefile before running it because recipes can execute arbitrary commands.
Your command toolkit
nano
What it solves: Edit a file with visible shortcuts.
nano notes.txt
Ctrl+O writes the file, Enter confirms its name, and Ctrl+X exits. The ^ symbol in nano's shortcut bar means Ctrl.
vim
What it solves: Edit using modes and repeatable actions.
vim notes.txt
Press i to insert, Escape to return to normal mode, then :wq and Enter to save and quit. :q! discards unsaved changes.
make
What it solves: Run a named local recipe.
make -n hello
In this course's known Makefile, -n previews the recipe. It is not a sandbox for an untrusted Makefile: expansion and recursive recipes can still execute code.
Before you move on
Try the guided lab below. Compare the result with the explanation, then record your reasoning in the workbook. A missing optional program or a restricted environment is something to explain, not a reason to change system settings blindly.
Practice with evidence
- Predict the result
- Run the guided lab
- Compare the output
- Explain your choice
A worked example
Guided lab
si_lab=$(mktemp -d)
cd "$si_lab" || exit
printf '.PHONY: hello\nhello:\n\t@printf "Hello from SI\\n"\n' > Makefile
cat Makefile
make -n hello
make hello
What to expect: The preview shows the printf recipe, and the actual target prints Hello from SI. make must be installed.
Make it yours: Use nano or vim to change the greeting. Record the save/exit sequence and explain why reviewing a Makefile matters.
Read further
- GNU Bash reference manual ↗www.gnu.org
Apply what you learned
Your private practice
Answers are private. Completion requires the correct knowledge-check answer and a written response when an activity is included.
Restore a downloaded workbook
Choose a recovery file for this course and version. Review the recovered copy before saving it to your account.
Ask a question or report a problem
Describe what needs attention. Your private answer is shared only if you select the option below.