Hands-on task
This task is step 24 of the course “Bash scripts: from a loop to a robust script”
Wait for a background job and grab its exit code
The script /root/worker.sh runs for about a second and exits with return code 3. Run it in the background, wait for it to finish, and write its return code to /root/worker_rc.txt. You need to grab the code of that specific background process.
What you'll practise:
- background processes
- wait
- $!
- return codes
- $?