Complete the code to run two commands in parallel.
command1 & [1]& after the second command runs it sequentially.wait here pauses the script instead of running in parallel.Adding & after command2 runs it in the background, so both commands run in parallel.
Complete the code to wait for all background jobs to finish.
command1 &
command2 &
[1]jobs only lists jobs but does not wait.fg brings a job to foreground but does not wait for all.The wait command pauses the script until all background jobs finish.
Fix the error in the code to run commands in parallel and wait for them.
command1 &
command2 [1]& after the second command runs it sequentially.jobs or fg instead of wait.The second command needs & to run in background for parallel execution. Then wait waits for all.
Fill both blanks to run commands in parallel and wait for them.
command1 [1] command2 [2] wait
; or && runs commands sequentially.| pipes output but does not run in background.Adding & after both commands runs them in background. Then wait pauses until both finish.
Fill all three blanks to run commands in parallel, wait, and then print done.
command1 [1] command2 [2] [3] echo "All done"
& causes sequential execution.wait may print message too early.Use & to run commands in background, then wait to pause until they finish, then print the message.