Write a script that creates three background processes, waits for them all to co
ID: 3629182 • Letter: W
Question
Write a script that creates three background processes, waits for them all to complete, and then displays a simple message. [level: medium]
Such a script will fork off three programs and then execute a wait command. This will cause the shell to sleep until all three programs have terminated. The next command after the wait command could be echo with a simple message.
Explanation / Answer
#!/usr/bin/env bash ping -c 5 google.com >& /dev/null & ping -c 5 yahoo.com >& /dev/null & ping -c 5 flickr.com >& /dev/null & wait echo "All pings have completed." ----------------------------------------------------------------------------- Please keep in mind: I am a college student too. I only do this for the karma points. I use the karma points to buy things I need as a supplement to financial aid. If you found this answer satisfactory, please give me the Lifesaver rating so that I get the full karma points for it. Thank you!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.