exam questions

Exam XK0-005 All Questions

View all questions & answers for the XK0-005 exam

Exam XK0-005 topic 1 question 78 discussion

Actual exam question from CompTIA's XK0-005
Question #: 78
Topic #: 1
[All XK0-005 Questions]

A systems administrator is implementing a new service task with systems at startup and needs to execute a script entitled test.sh with the following content:

The administrator tries to run the script after making it executable with chmod +x; however, the script will not run. Which of the following should the administrator do to address this issue? (Choose two.)

  • A. Add #!/bin/bash to the bottom of the script.
  • B. Create a unit file for the new service in /etc/systemd/system/ with the name helpme.service in the location.
  • C. Add #!//bin/bash to the top of the script.
  • D. Restart the computer to enable the new service.
  • E. Create a unit file for the new service in /etc/init.d with the name helpme.service in the location.
  • F. Shut down the computer to enable the new service.
Show Suggested Answer Hide Answer
Suggested Answer: BC 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Nvoid
Highly Voted 1 year, 11 months ago
Selected Answer: BC
B: Create unit file in /etc/systemd/system/ C: Add #!/bin/bash to the top of the script.
upvoted 6 times
...
dalv_01
Most Recent 6 months, 3 weeks ago
Selected Answer: A
in C is indicate wrong syntax "#!//bin/bash" double //
upvoted 1 times
...
wait4thebus
1 year ago
Selected Answer: BC
C is correct because every bash script should start with #!/bin/bash B is correct because /etc/systemd/system is the correct folder for a unit file. E is INCORRECT because /etc/init.d is an invalid folder path. E appears to be there to through people off the track of the correct answer.
upvoted 2 times
...
Alizadeh
1 year, 2 months ago
Selected Answer: AB
A. Add #!/bin/bash to the bottom of the script. B. Create a unit file for the new service in /etc/systemd/system/ with the name
upvoted 1 times
...
linux_admin
1 year, 8 months ago
Selected Answer: BC
C. Add #!/bin/bash to the top of the script. B. Create a unit file for the new service in /etc/systemd/system/ with the name helpme.service in the location. Option C is necessary because it specifies the interpreter for the script. The shebang line, "#!/bin/bash", must be added to the top of the script to indicate which interpreter should be used to run the script. Option B is necessary because the script must be registered as a service in the systemd system in order to be executed at startup. The administrator should create a unit file for the new service in /etc/systemd/system/ with the name helpme.service, which will describe how the service should be executed and how it should be managed by the system.
upvoted 2 times
...
Ckl22
1 year, 10 months ago
Selected Answer: BC
BC are the correct answers
upvoted 1 times
...
ryanzou
2 years ago
Selected Answer: AB
I think the answer is AB
upvoted 1 times
Veteran903
1 year, 11 months ago
NO!, its B and C, #!/bin/bash is the very first line at the beginning on the script not the bottom
upvoted 8 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago