nerdexam
CompTIA

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.

Shells, Scripting and Data Management

Question

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 ...

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)
  • A
    3% (1)
  • B
    89% (32)
  • C
    6% (2)
  • D
    3% (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.

Aignore the script

The shell does not ignore the script; it hands off execution to the specified interpreter.

Buse that binary to interpret the scriptCorrect

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.

Cuse that binary to compile the script

The shebang line designates an interpreter, not a compiler, so the script is interpreted, not compiled.

Dbe replaced by that binary

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

#shebang#script interpreter#shell scripting#binary path

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice