nerdexam
CompTIA

PT0-002 · Question #98

When developing a shell script intended for interpretation in Bash, the interpreter /bin/bash should be explicitly specified. Which of the following character combinations should be used on the…

The correct answer is E. #! The '#!' combination is called a 'shebang' (or hashbang). When placed at the very start of a script file followed by the interpreter path (e.g., '#!/bin/bash'), it tells the operating system kernel which interpreter to use to execute the script. Without it, the system may not…

Tools and Code Analysis

Question

When developing a shell script intended for interpretation in Bash, the interpreter /bin/bash should be explicitly specified. Which of the following character combinations should be used on the first line of the script to accomplish this goal?

Exhibit

PT0-002 question #98 exhibit

Options

  • A<#
  • B<$
  • C

  • D#$
  • E#!

How the community answered

(48 responses)
  • A
    8% (4)
  • B
    2% (1)
  • C
    2% (1)
  • E
    88% (42)

Explanation

The '#!' combination is called a 'shebang' (or hashbang). When placed at the very start of a script file followed by the interpreter path (e.g., '#!/bin/bash'), it tells the operating system kernel which interpreter to use to execute the script. Without it, the system may not know how to run the file or may use a different default shell. The other options (#, <#, <$, #$) have no special meaning as interpreter directives in Unix/Linux.

Topics

#shell scripting#bash#shebang#scripting fundamentals

Community Discussion

No community discussion yet for this question.

Full PT0-002 Practice