XK0-005 · Question #564
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…
The correct answer is B. Create a unit file for the new service in /etc/systemd/system/ with the name helpme.service in the C. Add #!//bin/bash to the top of the script. The administrator should do the following two things to address the issue: Add #!/bin/bash to the top of the script. This is called a shebang line and it tells the system which interpreter to use to execute the script. Without this line, the script will not run properly. The…
Question
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.)
Options
- AAdd #!/bin/bash to the bottom of the script.
- BCreate a unit file for the new service in /etc/systemd/system/ with the name helpme.service in the
- CAdd #!//bin/bash to the top of the script.
- DRestart the computer to enable the new service.
- ECreate a unit file for the new service in /etc/init.d with the name helpme.service in the location.
- FShut down the computer to enable the new service.
How the community answered
(22 responses)- A5% (1)
- B77% (17)
- D5% (1)
- F14% (3)
Explanation
The administrator should do the following two things to address the issue: Add #!/bin/bash to the top of the script. This is called a shebang line and it tells the system which interpreter to use to execute the script. Without this line, the script will not run properly. The shebang line should be the first line of the script and should start with #! followed by the path to the interpreter. In this case, the interpreter is bash and the path is /bin/bash.
Topics
Community Discussion
No community discussion yet for this question.