Content deleted Content added
m →top: use section sign |
Reverted 1 edit by 41.13.0.220 (talk): Edit summary doesn't correspond with edit |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 1:
{{short description|
{{redirect distinguish|System command|system call}}
{{other uses|Command (disambiguation)#Computing{{!}}Command
{{refimprove|date=May 2008 }}
In [[computing]], a '''command''' is
Many commands support arguments to specify input and to modify default behavior. Terminology and syntax varies but there are notable common approaches. Typically, an '''option''' or a '''flag''' is a name (without [[Whitespace character|whitespace]]) with a prefix such as [[dash]] or [[Slash (punctuation)|slash]] that modifies default behavior. An option might have a required value that follows it. Typically, flag refers to an option that does not have a following value. A '''parameter''' is an argument that specifies input to the command and its meaning is based on its position in the command line relative to other parameters; generally ignoring options. A parameter can specify anything, but often it specifies a [[file (computing)|file]] by [[filename|name]] or [[file path|path]].
The
▲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>
==Examples==
A notable context in which commands are prevalent is the [[operating system]] [[shell (computing)|shell]]. Commonly, the shell dispatches a command to a program that has a file name matching the first parameter. In a [[Unix shell]] (such as [[Bash (Unix shell)|bash]] and many related variants), the match must be exact including case. The following bash command changes the [[working directory]] to ''/home/pete'' by invoking the program ''[[Cd (command)|cd]]'':
<syntaxhighlight lang="bash">
</syntaxhighlight>
The following bash command
echo "Hello World"▼
<syntaxhighlight lang="bash">
</syntaxhighlight>
The following demonstrates how the default behavior of a command is modified with a switch. The switch {{code|-e}} causes the command to treat characters prefixed with a backslash as the associated control character. In this case {{code|\t}} results in a tab character.
<syntaxhighlight lang="bash">
Here are some commands for the [[DOS]], [[OS/2]] and [[Microsoft Windows]] [[Cmd.exe|command prompt]] processor. The following command displays the contents of the file ''readme.txt''. The program name is ''[[TYPE (DOS command)|type]]'' and the argument is ''readme.txt''.<ref>{{cite web | url = https://ss64.com/nt/type.html | access-date = 14 March 2019 | title = Type - Display a text file - Windows CMD | publisher = SS64.com }}</ref>▼
echo -e "Hello\tWorld"
type readme.txt▼
</syntaxhighlight>
dir /Q▼
<syntaxhighlight lang="batch">
</syntaxhighlight>
▲
<syntaxhighlight lang="batch">
</syntaxhighlight>
== See also ==
* [[Formal grammar]]▼
* [[Gesture recognition]]
* [[List of
* [[List of DOS commands]]
▲* [[Formal grammar]]
== References ==
|