Purpose
Interpreter directives allow scripts and data files to be used as system commands, hiding the details of their implementation from users and other programs, by removing the need to prefix scripts with their interpreter on the command line.
Consider a Bourne shell script that is identified by the path "some/path/to/foo" and that has the following as its initial line:
#!/bin/sh -x
If the user attempts to run this script with the following command line (specifying "bar" and "baz" as arguments):
some/path/to/foo bar baz
then the result would be similar to having actually executed the following command line instead:
/bin/sh -x some/path/to/foo bar baz
If "/bin/sh" specifies the Bourne shell, then the end result is that all of the shell commands in the file "some/path/to/foo" are executed with the positional variables $1 and $2 set to "bar" and "baz", respectively. Also, because the initial number sign is the character used to introduce comments in the Bourne shell language (and in the languages understood by many other interpreters), the entire shebang line is ignored by the interpreter.
However, it is up to the interpreter to ignore the shebang line; thus, a script consisting of the following two lines simply echos both lines to standard output when run:
#!/bin/cat Hello world!Read more about this topic: Shebang (Unix)
Famous quotes containing the word purpose:
“Our purpose in founding the city was not to make any one class in it surpassingly happy, but to make the city as a whole as happy as possible.”
—Socrates (469399 B.C.)
“A major misunderstanding of child rearing has been the idea that meeting a childs needs is an end in itself, for the purpose of the childs mental health. Mothers have not understood that this is but one step in social development, the goal of which is to help a child begin to consider others. As a result, they often have not considered their children but have instead allowed their childrens reality to take precedence, out of a fear of damaging them emotionally.”
—Elaine Heffner (20th century)
“I dont think life is absurd. I think we are all here for a huge purpose. I think we shrink from the immensity of the purpose we are here for.”
—Norman Mailer (b. 1923)