SK0-005 · Question #172
SK0-005 Question #172: Real Exam Question with Answer & Explanation
The correct answer is C: #!. #! is the symbol that should be placed at the top of a Bash script to ensure it can be executed. #! is also known as shebang or hashbang. It is a special notation that tells the operating system which interpreter to use to run the script. The shebang is followed by the path to th
Question
Which of me following should be placed at the top of a Bash script to ensure it can be executed?
Options
- Abash
- B!execute
- C#!
- D@eacho off
Explanation
#! is the symbol that should be placed at the top of a Bash script to ensure it can be executed. #! is also known as shebang or hashbang. It is a special notation that tells the operating system which interpreter to use to run the script. The shebang is followed by the path to the interpreter, such as /bin/bash for Bash, /bin/python for Python, or /bin/perl for Perl. For example, a Bash script that prints "Hello World" would start with: #!/bin/bash echo "Hello World" The shebang must be the first line of the script and must not have any spaces between the # and ! symbols. bash is not a valid shebang by itself, as it does not specify the path to the interpreter. !execute is not a valid shebang at all, as it does not start with #. @echo off is a command that disables the echoing of commands in a batch file on Windows, but it has nothing to do with Bash scripts on Linux.
Topics
Community Discussion
No community discussion yet for this question.