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

Write a script to print the first 10 elements of fibonacci series.

1756


c program to implement unix/linux command to block the signal ctrl-c and ctrl-\ signal during the execution ls -l|wc -l

3150


How to get the 3rd element/column from each line from a file?

683


How to get the first line from a file using just the terminal?

595


What is the way to do multilevel if-else's in shell scripting?

653






I have 2 files and I want to print the records which are common to both.

688


What is a shell script? Can you name some of its advantages?

525


What is web script?

578


What is bash coding?

495


Is cmd a shell?

589


How to set an array in linux?

591


Write down the syntax for all the loops in shell scripting.

654


What does $@ mean in shell?

590


What is meant by $1 in shell script?

546


What are zombie processes?

569