ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 136 - SK0-005 discussion

Report
Export

Which of me following should be placed at the top of a Bash script to ensure it can be executed?

A.
bash
Answers
A.
bash
B.
!execute
Answers
B.
!execute
C.
#!
Answers
C.
#!
D.
@eacho off
Answers
D.
@eacho off
Suggested answer: C

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. Reference: https://www.howtogeek.com/67469/the-beginners-guide-to-shellscripting- the-basics/ https://www.howtogeek.com/435903/what-is-a-shebang-line/

asked 02/10/2024
Michael Grisonichi
39 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first