DS0-001 · Question #59
DS0-001 Question #59: Real Exam Question with Answer & Explanation
The correct answer is D: #!/bin/bash. #!/bin/bash (option D) is the correct shebang line - the special first line of a shell script that tells the Linux kernel which interpreter to use when executing the file. The #! characters (called "shebang" or "hashbang") are the required magic bytes the kernel looks for, follow
Question
Which of the following is a typical instruction that is found on a Linux command-line script and represents a system shell?
Options
- A/bin/bash
- B#/bin/shell
- C>/bin/sh
- D#!/bin/bash
Explanation
#!/bin/bash (option D) is the correct shebang line - the special first line of a shell script that tells the Linux kernel which interpreter to use when executing the file. The #! characters (called "shebang" or "hashbang") are the required magic bytes the kernel looks for, followed by the absolute path to the interpreter.
Why the distractors are wrong:
- A (
/bin/bash) - missing the#!prefix entirely; this is just a path, not a valid shebang - B (
#/bin/shell) - missing the!after#, making it a regular comment that the shell ignores; also/bin/shellis not a standard interpreter path - C (
>/bin/sh) - the>is a redirection operator, not a shebang; this would attempt to redirect output to a file named/bin/sh
Memory tip: Think "shebang = she-BANG = #!" - the # is "she" and ! (called "bang" in Unix jargon) is the "bang." If you remember that ! is called "bang," the #! combination becomes unforgettable.
Community Discussion
No community discussion yet for this question.