Content deleted Content added
Blush30720 (talk | contribs) |
Blush30720 (talk | contribs) →Definitions: Move the paragraph on delineating lines from character streams down from subsection Execution to subsection Syntax Tag: Reverted |
||
Line 237:
=== ASCII, strings and numbers <span class="anchor" id="ASCII"></span> <span class="anchor" id="strings"></span> <span class="anchor" id="numbers"></span> ===
<!-- Important concepts: ASCII
[x] Characters
[x] Human/computer communitcation
Line 245:
[ ] Information
-->
<!-- Important concepts: strings
[x] String
[x] Filenames
-->
<!-- Important concepts: numbers
[x] Zero-based numbering
-->
{{Blockquote
| The input language to the shell shall be first recognized at the character level.<ref>
Line 316 ⟶ 324:
</syntaxhighlight>
Any series of characters is called a "[[String (computer science) |string]]," or sometimes a "[[string literal]]."
In Unix-like operating systems, all characters, printable and non-printing, except for a few such as the [[null character]] and forward slash {{char|/}}, can be used in naming [[Filenames |files]].
Line 337 ⟶ 341:
</ref>
In everyday life, people usually begin counting some group of items from the number one: 1, 2, 3 apples.
In computer science it is customary to do as the computers do and begin counting the first item from the number zero: 0, 1, 2 oranges, for a total of 3 oranges.
Line 402:
=== CLI and GUI <span class="anchor" id="CLI and GUI"></span> ===
<!-- Important concepts:
[x] Origin of CLI paradigm
[x] Origin of terminal emulators
[x] GUI
-->
{{Main
Line 411 ⟶ 417:
}}
Long after the first Analytical Engine, in the mid-1960's one of the primary ways for humans and computers to interact in real time was at a keyboard with a [[teleprinter]]: only display of textual characters was possible.<ref>
{{Cite web
Line 502 ⟶ 503:
[] stream of characters
[] delineate full commandlines (newline, semi-colon)
[x] Bash reads one line at a time
[x] Line continuation
[] division into commands and parts of commands (optargs)
[] uses metacharacters
-->
{{Blockquote
Line 528 ⟶ 521:
}}
A person typing at a keyboard creates something called a ''stream'' of characters.
In the [[Command-line interface#Comparison to graphical user interfaces |command-line interface]] [[paradigm]], via a [[terminal emulator]] Bash receives a series of characters from the user and expects each series of characters to be a command.
By default, Bash reads user code one line at a time, interprets any newline or semi-colon character {{code|;}} as the end of the current command, and executes commands in sequence.
If an interactive command extends beyond the width of the terminal emulator, it's usually possible to keep typing and the command will wrap around.
To extend a command beyond a newline onto an additional line, it's necessary that the final character of the first line be an unescaped backslash, {{code|\}}, which signals "line continuation."
Bash always finishes parsing and executing one full commandline before moving on to and beginning with the parsing of the next commandline.
:<syntaxhighlight lang="console">
$ foo=aa bar=bb quux=cc zork=dd; set -o xtrace
$ : "${foo}"; : "${bar}"
+ : aa
+ : bb
$ : "${quux}" \
> : "${zork}"
+ : cc : dd
$
</syntaxhighlight>
When Bash reads a ''full commandline,'' the complete string is broken down according to a certain set of rules into individual units called ''"tokens."''
<syntaxhighlight lang = text>
"Tokens"
\_ "Blanks"
\_ "Operators" (Ops)
\_ "Control Ops"
\_ "Redirection Ops"
\_ "Words"
\_ "Reserved Words"
\_ "Names"
</syntaxhighlight>
"Tokens" are identified using, and separated from each other using ''"metacharacters."'' (As of version 5.3:)
Line 618 ⟶ 642:
<!-- Important concepts:
[] replacement of placeholders / logical substitution
[] Expansion vs substitution
-->
"Expansion" is a crucial concept in Unix-like shells. See [[String interpolation]].
Line 650 ⟶ 676:
[x] Arrays
-->
For data structures Bash offers variables and arrays, and though there are numerous kinds of each of these available, the data structures are relatively simple compared to other languages like [[C (programming language) |C]] or [[Java (programming language) |Java]].<ref>{{Cite web
| access-date = 15 August 2025
Line 790 ⟶ 817:
=== Processes <span class="anchor" id="Processes"></span> ===
<!-- Important concepts:
Line 804 ⟶ 826:
[x] Working directory
-->
{{Main
| Process (computing)
| Attribute (computing)
}}
Each [[operating system]] (OS) has at its core a program called the [[Kernel (operating system) |kernel]] which runs commands.<ref name = Brit_control-unit>
{{Cite web
Line 845 ⟶ 873:
=== Files and permissions <span class="anchor" id="Files and permissions"></span><span class="anchor" id="Files"></span><span class="anchor" id="Permissions"></span> ===
<!-- This subsection is messy -->
Line 860 ⟶ 882:
[?] umask
-->
{{Main
| File system
| Unix file types
| File-system permissions
}}
In Unix-like operating systems, all objects locatable on the [[file system]] are considered to be "files."<ref name = tldp_3.1.1>
{{Cite web
Line 902 ⟶ 931:
=== Paths <span class="anchor" id="Paths"></span> ===
<!-- Important concepts:
Line 912 ⟶ 937:
[x] File anchor: './'
-->
{{Main |Path (computing)
| Hierarchical file system
}}
In Unix-like OS's, files, hardlinks, device nodes, etc., (i.e., "files") are sorted into [[Directory (computing) |directories]] that form a hierarchical file structure which is nested in a "parent" and "child" manner.
The base of the hierarchy is called the "root directory" which is denoted by one forward slash: {{char|/}}.
Line 937 ⟶ 967:
=== Execution <span class="anchor" id="Execution"></span> ===
<!-- Important concepts:
[x] Execution / to execute a command
[x] An executable
[x] Command position
[ ] A single logical construct is parsed as a single unit
-->
{{Main
| Execution (computing)
}}
"Execution" of a given program occurs when a user (or some other program) asks the operating system to act upon the instructions contained in the given program.
The first word of a commandline is known as the "command position."
|