MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

UNIX

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The first line in any shell script begins with a ____
A
&
B
!
C
$
D
#
Explanation: 

Detailed explanation-1: -The first line starts with the sequence of two characters #! that is called shebang. This is followed by the program that tells the operating system which interpreter to use to parse the rest of the file. In the example below, the program is /bin/bash which is a Unix shell.

Detailed explanation-2: -The first line called a hashbang or shebang. It tells Unix that this script should be run through the /bin/bash shell. Second line is just the echo statement, which prints the words after it to the terminal.

Detailed explanation-3: -The #! line in a shell script will be the first thing the command interpreter (sh or bash) sees. Since this line begins with a #, it will be correctly interpreted as a comment when the command interpreter finally executes the script. The line has already served its purpose-calling the command interpreter.

Detailed explanation-4: -The first major shell was the Bourne shell (named after its inventor, Steven Bourne); it was included in the first popular version of UNIX, Version 7, starting in 1979. The Bourne shell is known on the system as sh.

There is 1 question to complete.