LPIC-1 Shells, Scripting and Data Management Practice Question
A script starts multiple background processes. An administrator wants to wait for all background jobs to complete before proceeding. Which command should be used?
⚠ Common exam trap
A common mix-up: candidates confuse `wait` with `jobs` or assume that a fixed sleep duration is sufficient, not realizing that `wait` is the only command that dynamically synchronizes with the actual completion of all background jobs.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
wait
The `wait` command without any arguments waits for all background jobs spawned by the current shell to complete before returning control to the script. This is the correct way to synchronize multiple background processes in a shell script, ensuring all child processes finish before proceeding to the next command.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
jobs -l
Why it's wrong here
jobs -l only lists background jobs with their process IDs; it reports status without blocking, so the script continues immediately. It is tempting because it displays the jobs you want to await, but listing is informational, whereas wait suspends execution until those jobs terminate.
- ✗
wait %1
Why it's wrong here
wait %1 blocks only for job number one, so other background processes may still be running when the script proceeds. It is tempting because wait is the right builtin, yet the bare wait with no argument is what waits for all background jobs to complete.
- ✓
wait
Why this is correct
`wait` with no arguments blocks the calling shell until every background job it spawned has terminated, then returns. This directly satisfies the stem's requirement to pause the script until all background processes finish, unlike `sleep` or polling loops that cannot detect job completion.
- ✗
sleep 5
Why it's wrong here
sleep pauses for a fixed interval regardless of whether the background jobs have finished, so completion is not guaranteed. It is tempting as a crude synchronisation delay, and it would be acceptable only when a known maximum runtime makes a fixed pause reliable, not for arbitrary jobs.
Visual reference
Go deeper
Related to this question
About these practice questions
Courseiva writes every LPIC-1 question from scratch — 402 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LPIC-1 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-1 exam.