nerdexam
LPI

102-500 · Question #193

You are looking into a new script you received from your senior administrator. In the very first line you notice a #! followed by a file path. This indicates that:

The correct answer is D. The program at that location will be used to process the script. Option D is correct because #! (called a "shebang" or "hashbang") tells the operating system which interpreter to use when executing the script - for example, #!/bin/bash means "run this script using the Bash program at /bin/bash." Option A is wrong because the shebang has…

Shells and Shell Scripting

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 file path. This indicates that:

Options

  • AThe file at that location was used to make the script.
  • BThis script provides identical functionality as the file at that location.
  • CThis script will self-extract into a file at that location.
  • DThe program at that location will be used to process the script.

How the community answered

(55 responses)
  • A
    7% (4)
  • B
    4% (2)
  • C
    11% (6)
  • D
    78% (43)

Explanation

Option D is correct because #! (called a "shebang" or "hashbang") tells the operating system which interpreter to use when executing the script - for example, #!/bin/bash means "run this script using the Bash program at /bin/bash." Option A is wrong because the shebang has nothing to do with how the script was created; it's purely a runtime instruction. Option B is wrong because the script and the referenced program are entirely different things - the script is the code to be processed, and the program is the processor. Option C is wrong because shebangs have no self-extraction functionality; that concept relates to archive formats like .run or .sh installer bundles, not standard script headers.

Memory tip: Think of #! as a "hire this interpreter" directive - the path after it is the employee (program) that will do the work of reading and running your script.

Topics

#shebang#script interpreters#executable scripts#shell processing

Community Discussion

No community discussion yet for this question.

Full 102-500 Practice