linux shebang
A shebang refers to the first two characters in a script, #!. When those appear at the beginning of the first line of a text file that has had it's executable bit set, and are followed by a valid command interpreter, Linux passes the script to it. Now just to be clear, the only reason I say a "valid command interpreter" is that that is the intent. You can get away with using the path to any executable program. So what happens when I start a script with
- #!/usr/bin/perl -w
it will run /usr/bin/perl
with the flag -w
, followed by the name of the file. So if the file was foo.pl
, the command line that will actually be executed will be
- /usr/bin/perl -w foo.pl
It will work with the interpreters for pretty much any interpreted language.
No comments:
Post a Comment