Shebang
From Just Solve the File Format Problem
(Difference between revisions)
(→Links) |
(→Links) |
||
Line 13: | Line 13: | ||
== Links == | == Links == | ||
* [[Wikipedia: Shebang (Unix)]] | * [[Wikipedia: Shebang (Unix)]] | ||
+ | * [https://www.in-ulm.de/~mascheck/various/shebang/ The #! magic] | ||
* [https://homepages.cwi.nl/~aeb/std/hashexclam.html #! - the Unix truth as far as I know it.] | * [https://homepages.cwi.nl/~aeb/std/hashexclam.html #! - the Unix truth as far as I know it.] | ||
[[Category:Executables]] | [[Category:Executables]] | ||
[[Category:Source code]] | [[Category:Source code]] |
Latest revision as of 16:46, 22 November 2017
A shebang (also called a hashbang, and other equally silly names) is line of text that associates a file (usually a script to be interpreted) with an application. The technique is crude but effective, and is ubiquitous on Unix-like systems.
[edit] Format details
If one attempts to execute a file whose contents begin with "#!
", a Unix-like operating system looks for the name of a program after the "#!", and executes that program instead, with the original file as a parameter. This effectively makes the original file itself executable.
An example of a shebang is
#!/usr/bin/perl -w