LX0-104 · Question #460
You are looking into a new script you received from your senior administrator. In the very first line you notice a #! followed by a path to a binary. The shell will ...
The correct answer is B. use that binary to interpret the script. The #! (shebang) line at the beginning of a script specifies the interpreter program that should be used to execute the script.
Question
Options
- Aignore the script
- Buse that binary to interpret the script
- Cuse that binary to compile the script
- Dbe replaced by that binary
How the community answered
(36 responses)- A3% (1)
- B89% (32)
- C6% (2)
- D3% (1)
Why each option
The `#!` (shebang) line at the beginning of a script specifies the interpreter program that should be used to execute the script.
The shell does not ignore the script; it hands off execution to the specified interpreter.
When a script starts with `#!` followed by a path to an executable, the kernel reads this line and executes the specified binary, passing the script file as its first argument. This process allows the script to be interpreted by the designated program, rather than the default shell.
The shebang line designates an interpreter, not a compiler, so the script is interpreted, not compiled.
The shell is not replaced; it is the initial process that might launch the interpreter specified by the shebang, which then executes the script.
Concept tested: Shebang line script interpreter
Source: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shebang
Topics
Community Discussion
No community discussion yet for this question.