nerdexam
CompTIA

XK0-005 · Question #751

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?

The correct answer is A. bash script.sh &. bash script.sh & is correct. Appending & to a command sends it to the background as a job, immediately returning the shell prompt so the administrator can continue troubleshooting in the same terminal session. 'source script.sh' (B) runs the script in the current shell…

System Management

Question

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?

Options

  • Abash script.sh &
  • Bsource script.sh
  • Csh script.sh | jobs
  • Dnice -10 ./script.sh

How the community answered

(61 responses)
  • A
    77% (47)
  • B
    3% (2)
  • C
    13% (8)
  • D
    7% (4)

Explanation

bash script.sh & is correct. Appending & to a command sends it to the background as a job, immediately returning the shell prompt so the administrator can continue troubleshooting in the same terminal session. 'source script.sh' (B) runs the script in the current shell environment in the foreground, blocking the terminal. 'sh script.sh | jobs' (C) is invalid - jobs is a shell built-in that lists background jobs and cannot be used as a pipeline destination. 'nice -10 ./script.sh' (D) adjusts the scheduling priority but still runs the script in the foreground, blocking the terminal.

Topics

#Background processes#Shell commands#Job control#Linux administration

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice