0
0
Bash Scriptingscripting~10 mins

Parallel execution patterns in Bash Scripting - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to run two commands in parallel.

Bash Scripting
command1 & [1]
Drag options to blanks, or click blank then click option'
Acommand2 &
Bcommand2
Cwait
Dsleep 1
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting & after the second command runs it sequentially.
Using wait here pauses the script instead of running in parallel.
2fill in blank
medium

Complete the code to wait for all background jobs to finish.

Bash Scripting
command1 &
command2 &
[1]
Drag options to blanks, or click blank then click option'
Ajobs
Bfg
Cwait
Dkill
Attempts:
3 left
💡 Hint
Common Mistakes
Using jobs only lists jobs but does not wait.
Using fg brings a job to foreground but does not wait for all.
3fill in blank
hard

Fix the error in the code to run commands in parallel and wait for them.

Bash Scripting
command1 &
command2 [1]
Drag options to blanks, or click blank then click option'
Ajobs
Bwait
Cfg
Dkill
Attempts:
3 left
💡 Hint
Common Mistakes
Not adding & after the second command runs it sequentially.
Using jobs or fg instead of wait.
4fill in blank
hard

Fill both blanks to run commands in parallel and wait for them.

Bash Scripting
command1 [1]
command2 [2]
wait
Drag options to blanks, or click blank then click option'
A&
B;
C&&
D|
Attempts:
3 left
💡 Hint
Common Mistakes
Using ; or && runs commands sequentially.
Using | pipes output but does not run in background.
5fill in blank
hard

Fill all three blanks to run commands in parallel, wait, and then print done.

Bash Scripting
command1 [1]
command2 [2]
[3]
echo "All done"
Drag options to blanks, or click blank then click option'
A&
Bwait
C;
D&&
Attempts:
3 left
💡 Hint
Common Mistakes
Not using & causes sequential execution.
Not using wait may print message too early.