Skip to content

Commit 9e3f6d8

Browse files
committed
more typo fixing
1 parent 253b22f commit 9e3f6d8

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

docs/index.md

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ The project lies at the intersection of C programming and system programming. Ev
7575
- POSIX: A family of open system standards based on Unix.
7676
- Builtin: A command that is implemented internally by the shell itself, rather than by an executable program somewhere in the file system.
7777
- Operator: A control operator or a redirection operator.
78-
- Control operator: A token that performs a control function. It is a newline or one of the following: ‘||’, ‘&&’, ‘&’, ‘;’, ‘;;’, ‘;&’, ‘;;&’, ‘|’, ‘|&’, ‘(’, or ‘)’.
79-
- Redirection operator: A token redirects input and out put to and from files by manipulating file descriptors: '<', '>', '>>', '&>'
80-
- Heredoc: '<<'
78+
- Control operator: A token that performs a control function. It is a newline or one of the following: ‘||’, ‘&&’, ‘&’, ‘;’, ‘;;’, ‘;&’, ‘;;&’, ‘|’, ‘|&’, ‘(’, or ‘)’.
79+
- Redirection operator: A token redirects input and out put to and from files by manipulating file descriptors: '<', '>', '>>', '&>'
80+
- Heredoc: '<<'
8181
- Exit status: The value returned by a command to its caller. The value is restricted to eight bits, so the maximum value is 255.
8282
- Metacharacter: A character that, when unquoted, separates words. A metacharacter is a space, tab, newline, or one of the following characters: ‘|’, ‘&’, ‘;’, ‘(’, ‘)’, ‘<’, or ‘>’.
8383
- Reserved word: A word that has a special meaning to the shell. Most reserved words introduce shell flow control constructs, such as 'for' and 'while'. (not strictly enforced by the shell)
@@ -125,11 +125,11 @@ A formal grammar takes a set of atomic pieces it calls its “alphabet”. Then
125125

126126
A grammar naturally describes the hierarchical structure of most programming language constructs. For example, an if-else statement in Java can have
127127

128-
```if (expression) statement else statement```
128+
`if (expression) statement else statement`
129129

130130
That is, an if-else statement is the concatenation of the keyword if, an opening parenthesis, an expression, a closing parenthesis, a statement, the keyword else, and another statement. Using the variable expr to denote an expression and the variable stmt to denote a statement, this structuring rule can be expressed as
131131

132-
```stmt →if (expr) stmt else stmt```
132+
`stmt →if (expr) stmt else stmt`
133133

134134
If you start with the rules, you can use them to generate strings that follow the grammar. Strings created this way are called derivations because each is “derived” from the rules of the grammar. In each step, you pick a rule and follow what it tells you to do. Most of the lingo around formal grammars comes from implementing them in this direction. Rules are called productions because they produce strings in the grammar.
135135
Each production in a context-free grammar has a head—its name—and a body which describes what it generates. In its pure form, the body is simply a list of symbols. Symbols come in two delectable flavors:
@@ -155,8 +155,8 @@ Some of the tokens that are of interest to us:
155155
| blank | A space or tab character. |
156156
| word | A sequence of characters considered as a single unit by the shell. Also known as a token. |
157157
| name | A word consisting only of alphanumeric characters and underscores, and beginning with an alphabetic character or an underscore. Also referred to as an identifier. |
158-
| metacharacter | A character that, when unquoted, separates words. A metacharacter is a space, tab, newline, or one of the following characters: '\|', '&', ';', '(', ')', '<', or '>'. |
159-
| control operator | A token that performs a control function. It is a newline or one of the following: '\|\|', '&&', '&', ';', ';;', ';&', ';;&', '\|', '\|&', '(', or ')'. |
158+
| metacharacter | A character that, when unquoted, separates words. A metacharacter is a space, tab, newline, or one of the following characters: '|', '&', ';', '(', ')', '<', or '>'. |
159+
| control operator | A token that performs a control function. It is a newline or one of the following: '||', '&&', '&', ';', ';;', ';&', ';;&', '|', '|&', '(', or ')'. |
160160
| operator | A sequence of characters considered a single unit by the shell. It is either a word or an operator. |
161161
| reserved word | A word that has a special meaning to the shell. Most reserved words introduce shell flow control constructs, such as loops or conditionals. The reserved words recognized by the shell are: `! case esac do done if elif else fi for in then until while { } time [[ ]]`
162162

@@ -454,12 +454,12 @@ Redirection operators in Bash allows the user to manipulate where a command read
454454
4. **`<<` (Here Document):**
455455
- Allows you to pass multiple lines of input to a command.
456456
- Example:
457-
```bash
457+
```bash
458458
cat << EOF
459459
Line 1
460460
Line 2
461461
EOF
462-
```
462+
```
463463
This command uses a here document to pass multiple lines to the `cat` command.
464464
465465
From the Bash manual:
@@ -470,7 +470,7 @@ Redirection must be distinguished from "Process substitution", which "allows a p
470470
471471
Effectively, the redirection symbols are followed by a filename (or word that is expanded to a file name), which is opened for writing ('>'), writing and appending ('>>') or reading ('<') and its file descriptor then duplicated to act as stdout ('>' and '>>') or stdin ('<') depending on the redirection. So in a command comprised of several tokens, containing redirection symbols, each redirection token and the token to the right of it are interpreted, opening attempted of the file specified and file descriptor(s) duplicated. The remaining token are then passed on for execution.
472472
A fun illustration:
473-
```echo hello > world here I am```
473+
`echo hello > world here I am`
474474
In this case stdout is redirected to the file "world", which is created if does not exist and then the rest of the command is executed. As a result the file world contains the string "hello here I am".
475475
476476
### Pipes
@@ -635,73 +635,73 @@ Some examples of using `&&` (logical AND) and `||` (logical OR) with parentheses
635635
### Using `&&` (Logical AND):
636636
637637
1. **Basic `&&` Example:**
638-
```bash
638+
```bash
639639
command1 && command2
640-
```
640+
```
641641
- If `command1` succeeds (returns a zero exit status), then `command2` will be executed.
642642
643643
2. **Multiple Commands with `&&`:**
644-
```bash
644+
```bash
645645
(command1 && command2) && command3
646-
```
646+
```
647647
- `command1` and `command2` are executed in sequence. If both succeed, then `command3` is executed.
648648
649649
3. **Mixing `&&` and `||`:**
650-
```bash
650+
```bash
651651
(command1 && command2) || command3
652-
```
652+
```
653653
- If `command1` and `command2` succeed, then `command3` will not be executed. If either `command1` or `command2` fails, then `command3` will be executed.
654654
655655
### Using `||` (Logical OR):
656656
657657
1. **Basic `||` Example:**
658-
```bash
658+
```bash
659659
command1 || command2
660-
```
660+
```
661661
- If `command1` fails (returns a non-zero exit status), then `command2` will be executed.
662662
663663
2. **Multiple Commands with `||`:**
664-
```bash
664+
```bash
665665
(command1 || command2) || command3
666-
```
666+
```
667667
- `command1` is executed. If it fails, then `command2` is executed. If both fail, then `command3` is executed.
668668
669669
3. **Mixing `&&` and `||`:**
670-
```bash
670+
```bash
671671
(command1 || command2) && command3
672-
```
672+
```
673673
- If `command1` succeeds, then `command2` will not be executed, and `command3` will be executed. If `command1` fails, then `command2` is executed, and `command3` will not be executed.
674674
675675
Wildcards, such as `*`, are used for pattern matching in file names. Here are some examples of using wildcards in the current working directory:
676676
677677
1. **List all files in the current directory:**
678-
```bash
678+
```bash
679679
ls *
680-
```
680+
```
681681
- This command lists all files (and directories) in the current directory.
682682
683683
2. **Remove all text files in the current directory:**
684-
```bash
684+
```bash
685685
rm *.txt
686-
```
686+
```
687687
- This command removes all files with a `.txt` extension in the current directory.
688688
689689
3. **Copy all `.jpg` files to another directory:**
690-
```bash
690+
```bash
691691
cp *.jpg /path/to/destination/
692-
```
692+
```
693693
- This command copies all files with a `.jpg` extension to the specified destination directory.
694694
695695
4. **Count the lines in all `.log` files:**
696-
```bash
696+
```bash
697697
wc -l *.log
698-
```
698+
```
699699
- This command counts the number of lines in each file with a `.log` extension in the current directory.
700700
701701
5. **Grep for a specific pattern in all `.md` files:**
702-
```bash
702+
```bash
703703
grep "pattern" *.md
704-
```
704+
```
705705
- This command searches for the specified pattern in all files with a `.md` extension.
706706
707707
These examples demonstrate how wildcards can be used in combination with various commands for file manipulation and processing in the current working directory.
@@ -866,7 +866,9 @@ Look at these cases in bash:
866866
<<1 cat | <<2 cat | ( <<3 cat | <<4 cat || <<5 cat | ( <<6 cat ) && <<7 cat ) | <<8 cat <<9 | <<10 cat
867867
```
868868
#### case 2 (syntax error):
869-
```<<1 cat | <<2 cat | ( <<3 cat | <<4 cat || <<5 cat | ( <<6 cat ) && <<7 cat ) | () <<8 cat <<9 | <<10 cat```
869+
```bash
870+
<<1 cat | <<2 cat | ( <<3 cat | <<4 cat || <<5 cat | ( <<6 cat ) && <<7 cat ) | () <<8 cat <<9 | <<10 cat
871+
```
870872
#### case 3 (syntax error):
871873
```
872874
<<1 cat | <<2 cat | ( <<3 cat | <<4 cat || <<5 cat | ( <<6 cat ) && <<7 cat ) | <<8 () cat <<9 | <<10 cat

0 commit comments

Comments
 (0)