In a Unix shell script, the interpreter directive on the first line begins…
2019
In a Unix shell script, the interpreter directive on the first line begins with which character?
Answer: D. # — ConceptWhen an executable text file is launched directly, Unix can use an interpreter directive, commonly called a shebang, at the very start of the file. Its…
- A.
&
- B.
!
- C.
$
- D.
#
Show answer & explanation
Correct answer: D
Concept
When an executable text file is launched directly, Unix can use an interpreter directive, commonly called a shebang, at the very start of the file. Its two-character marker is #!, followed by the path of the interpreter, such as /bin/sh.
Application
The question asks only for the character that begins this first-line marker. In #!, the leading character is #, so the required character is #.
Contrast
&: a shell control operator commonly used to run a command asynchronously.!: used for history expansion in shells that enable that feature.$: introduces parameter or command expansion.#: the leading character of the#!interpreter directive.
Cross-check
A typical first line is #!/bin/sh. Reading it from left to right confirms that # is the first character and ! is the second.