You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/books/learning_bash/07-loops.md
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,9 +39,21 @@ Whatever the loop used, the commands to be repeated are placed **between the wor
39
39
40
40
The `while` / `do` / `done` structure evaluates the command placed after `while`.
41
41
42
-
If this command is true (`$? = 0`), the commands placed between `do` and `done` are executed. The script then returns to the beginning to evaluate the command again.
42
+
When the evaluated command is true:
43
43
44
-
When the evaluated command is false (`$? != 0`), the shell resumes the execution of the script at the first command after done.
44
+
```
45
+
$? = 0
46
+
```
47
+
48
+
the commands placed between `do` and `done` are executed. The script then returns to the beginning to evaluate the command again.
49
+
50
+
When the evaluated command is false:
51
+
52
+
```
53
+
$? != 0
54
+
```
55
+
56
+
the shell resumes the execution of the script at the first command after done.
45
57
46
58
Syntax of the conditional loop structure `while`:
47
59
@@ -140,7 +152,13 @@ done
140
152
141
153
The `until` / `do` / `done` structure evaluates the command placed after `until`.
142
154
143
-
If this command is false (`$? != 0`), the commands placed between `do` and `done` are executed. The script then returns to the beginning to evaluate the command again.
155
+
When the evaluated command is false:
156
+
157
+
```
158
+
$? != 0
159
+
```
160
+
161
+
the commands placed between `do` and `done` are executed. The script then returns to the beginning to evaluate the command again.
144
162
145
163
When the evaluated command is true (`$? = 0`), the shell resumes the execution of the script at the first command after `done`.
0 commit comments