LX0-104 · Question #555
An administrator is looking into a new script that they have just received from a senior administrator. In the very first line the administrator notices a #! followed by a path to a binary. Linux will
The correct answer is B. use that binary to interpret the script.. When a script begins with a #! (shebang) followed by a path to a binary, Linux uses that specified binary as the interpreter to execute the script's contents.
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
(51 responses)- A4% (2)
- B92% (47)
- C2% (1)
- D2% (1)
Why each option
When a script begins with a `#!` (shebang) followed by a path to a binary, Linux uses that specified binary as the interpreter to execute the script's contents.
The shebang line indicates the script is intended for execution, not to be ignored.
The `#!` (shebang) sequence at the beginning of a script is a convention understood by the Linux kernel's program loader. When an executable script is invoked, the kernel reads the shebang line and uses the path specified after `#!` (e.g., `/bin/bash`, `/usr/bin/python`) to execute the script as an argument to that interpreter.
The binary specified by `#!` is typically an interpreter, not a compiler, meaning it executes the script directly rather than transforming it into machine code.
The binary interprets the script; it does not replace the Linux operating system.
Concept tested: Shebang line script execution
Source: https://manpages.org/man/2/execve
Topics
Community Discussion
No community discussion yet for this question.