What is the need of including script interpreter in your
shell script?

Answer Posted / ganesh

When you ask a shell to execute the command $ date, the
shell uses the system call exec to
ask the UNIX kernel to execute the command you requested.

The shell passes the name of the command that should be
executed to the exec system call.
This system call reads the first two characters in a file to
determine how to execute the command.


In the case of shell scripts, the first two characters are
#!, indicating that the script needs to be interpreted by
another program instead of executed directly.

The rest of the line is treated as the name of the
interpreter to use.
Usually the interpreter is /bin/sh, but you can also specify
options to the shell on this line

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does $@ mean bash?

825


How do I run a .sh file?

779


Why is it called a shell?

673


What is shift command in shell script?

703


Tell something about the super block in shell scripting?

773


How do I read a .sh file?

727


What is the syntax of "nested if statement" in shell scripting?

795


In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?

810


What is the syntax of while loop in shell scripting?

763


Explain about stdin, stdout and stderr?

802


Explain about gui scripting?

811


How do I open the shell in cmd?

744


What is the crontab?

722


Is powershell a language?

740


Print the 10th line without using tail and head command.

1934