In the case of a textual script file, if the first two characters of the file are the characters # and then !, the shell program that's used to interpret the file is taken from the rest of that line. (If not, the file is thrown at the default shell for that user. Since shell languages differ syntactically, this is to be avoided.)
Interpreters that are not considered shells can also be used if that script is written in the corresponding language.
Here are some typical examples you might find at the top of a
script:
#!/bin/sh # run with borne shell
#!/bin/csh # run with C shell
#!/usr/bin/perl # run a perl program
#!/usr/bin/perl -w # run a
perl program, with warnings turned on
#!/bin/bash # run specifically
with Bash shell
Pronounciation: this rule is usually pronounced The she-bang rule.
Outside of Mac OS, the file is ignored.
Documentation >
Glossary >
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0123456789 punctuation |
|
||||