Interpreter directive: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
BattyBot (talk | contribs)
Looks like a duplcate
Tags: New redirect Reverted
Line 1: Line 1:
#REDIRECT [[Directive (programming)]]
{{short description|Computer language construct to control an interpreter}}
{{Confusing|date=February 2016}}
An '''interpreter directive''' is a [[computer language]] construct, that on some systems is better described as an aspect of the system's executable file format, that is used to control which [[Interpreter (computing)|interpreter]] parses and interprets the instructions in a [[computer program]].<ref>{{cite book|last1= Weik |first1= Martin H. |title= Computer Science and Communications Dictionary |url= https://books.google.com/books?id=gbP1bLDPKlYC&pg=PA829 |volume= 1 |year= 2000 |publisher= [[Springer Science+Business Media|Springer]] |isbn= 978-0-7923-8425-0 |page= 829 }}</ref>

In [[Unix]], [[Linux]] and other [[Unix-like]] [[operating system]]s, the first two bytes in a file can be the characters "#!", which constitute a [[magic number (programming)|magic number]] ([[hexadecimal]] 23 and 21, the ASCII values of "#" and "!") often referred to as [[Shebang (Unix)|shebang]], prefix the first line in a [[script (Unix)|script]], with the remainder of the line being a command usually limited to a max of 14 (when introduced) up to usually about 80 characters in 2016{{Citation needed|date = May 2016}}. If the [[file system permissions]] on the script (a file) include an [[Execution (computing)|execute]] permission bit for the user invoking it by its filename (often found through the command search path), it is used to tell the operating system what interpreter (usually a program that implements a [[scripting language]]) to use to execute the [[Shell script|script]]'s contents, which may be [[Batch processing|batch commands]] or might be intended for interactive use. An example would be ''#!/bin/bash'', meaning run this script with the [[Bash (Unix shell)|bash shell]] found in the /bin [[Unix filesystem#Conventional directory layout|directory]].<ref>{{cite web|title=Advanced Bash Scripting Guide|url=http://tldp.org/LDP/abs/html/sha-bang.html|access-date=2012-01-19}}</ref><ref>{{cite book
|last=Cooper
|first=Mendel
|title=Advanced Bash Scripting Guide 5.3 Volume 1
|publisher=lulu.com
|date=November 5, 2010
|isbn=978-1-4357-5218-4
|page=5
|url=https://books.google.com/books?id=WPXkgFRd4OEC&q=sha-bang&pg=PA5
}}</ref><ref>{{cite book
|last=MacDonald
|first=Matthew
|title=HTML5: The Missing Manual
|publisher=[[O'Reilly Media]]
|location=Sebastopol, California
|year=2011
|isbn=978-1-4493-0239-9
|page=373
|url=https://books.google.com/books?id=SR7HXy2XvBEC&pg=PA373
}}</ref><ref>{{cite book
|last=Lutz
|first=Mark
|title=Learning Python
|edition=4th
|publisher=[[O'Reilly Media]]
|date=September 2009
|isbn=978-0-596-15806-4
|page=48
|url=https://books.google.com/books?id=1HxWGezDZcgC&pg=PA48
}}</ref><ref>{{cite book
|last=Lie Hetland
|first=Magnus
|title=Beginning Python: From Novice to Professional
|publisher=Apress
|date=October 4, 2005
|isbn=978-1-59059-519-0
|page=21
|url=https://books.google.com/books?id=S0l1YFpRFVAC&q=pound+bang&pg=PA21
}}</ref><ref>{{cite book
|last=Schitka
|first=John
|title=Linux+ Guide to Linux Certification
|publisher=Course Technology
|date=December 24, 2002
|isbn=978-0-619-13004-6
|page=353
|url=https://books.google.com/books?id=l7JhL9rJLEgC&q=hashpling&pg=PA353
}}</ref>

Other systems or files may use some other ''[[Magic number (programming)|magic number]]'' as the interpreter directives.

== See also ==
* [[Architecture description language]]
* [[Bourne shell]]
* [[C shell]]
* [[Command-line interface#Command-line interpreter]]
* [[Filename extension#Command name issues]]
* [[Shebang (Unix)]]
* [[Unix shell]]

== References ==
{{Reflist|35em}}

{{DEFAULTSORT:Interpreter Directive}}
[[Category:Command shells]]
[[Category:Computing terminology]]


{{Computing-stub}}

Revision as of 03:31, 25 February 2023