CompTIA Linux+ (XK0-005) — Question 273
An administrator wants to execute a long running script in the terminal while troubleshooting another issue. Which of the following options will achieve this goal?
Answer options
- A. bash script.sh &
- B. source script.sh
- C. sh script.sh | jobs
- D. nice -10./script.sh
Correct answer: A
Explanation
The correct answer is A because executing 'bash script.sh &' runs the script in the background, allowing the administrator to continue working in the terminal. Option B, 'source script.sh', runs the script in the foreground, which would block the terminal. Option C, 'sh script.sh | jobs', attempts to pipe output to 'jobs', which does not run the script in the background. Option D, 'nice -10./script.sh', runs the script with a lower priority but does not place it in the background.