Command (computing): Difference between revisions

Content deleted Content added
Undid revision 1153528435 by 2600:1702:4FD1:4210:F5F2:648:9DCB:BBB0 (talk) since it appears to be a test edit (?)
Tried to clear up some confusion when it comes to nomenclature
Line 3:
{{other uses|Command (disambiguation)#Computing{{!}}Command#Computing}}
{{refimprove|date=May 2008 }}
In [[computing]], a '''command''' is a directive to a computer program to perform a specific task. It may be issued via a [[command-line interface]], such as a [[shell (computing)|shell]], or as input to a network service as part of a [[network protocol]], or as an event triggered in a [[graphical user interface]] triggered by the user selecting an option in a [[menu (computing)|menu]].
 
Specifically, the term ''command'' is used in [[imperative programming|imperative]] [[computer language]]slanguages. The name arises because [[statement (programming)|statements]] in these languages are usually written in a manner similar to the [[imperative mood]] used in many [[natural language]]s. If one views aA statement in an [[imperative programming language]] aswould beingthen likebe a sentence in a natural language, thenand athe command iswould generallybe likethe a verb in such a language[[Predicate_(grammar)|predicate]].
 
Many programs allow speciallyspecifically formatted [[Parameter (computer science)|arguments]], known as flags or options, which modify the default behaviour of the program, while further [[Parameter (computer science)|arguments]] may provide objects, such as files, to act on. As an analogy to a natural language, the flags are adverbs, while the other arguments are [[object (grammar)|object]]s.
 
==Distinction between ''command'' and [[Expression_(computer_science)|expression]], [[Statement_(computer_science)|statement]] and [[Function_(computer_programming)|function]]==
The meaning of ''command'' is highly dependent on context. For example, some authors refer to [[Conditional_(computer_programming)|conditionals]] as commands <ref>Maurizio Gabbrielli, Simone Martini (2010). Programming Languages - Principles and Paradigms. Springer London, ''6.3.2 Conditional Commands'', p. 140</ref> while they are called ''expressions'' in Python<ref>{{cite web | url = https://docs.python.org/3/reference/expressions.html | access-date = 23 October 2023 | title = Conditional expressions | publisher = python.org }}</ref> or Bash<ref>{{cite web | url = https://www.gnu.org/software/bash/manual/html_node/Bash-Conditional-Expressions.html | access-date = 23 October 2023 | title = Bash Conditional expressions | publisher = gnu.org }}</ref> and ''statements'' in JAVA.<ref>{{cite web | url = https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html | access-date = 23 October 2023 | title = The if-then and if-then-else Statements | publisher = oracle.com }}</ref>
Similarly, writing to [[Standard_streams#Standard_output_(stdout)|stdout]] is done in Bash with the builtin ''command'' [[Printf_(Unix)|printf]], while it is done with the built-in ''function'' print() in Python.<ref>{{cite web | url = https://docs.python.org/3/library/functions.html#print | access-date = 23 October 2023 | title = Built-in Functions - print | publisher = python.org }}</ref>
 
==Examples==