Skip to content

Commit 81756aa

Browse files
authored
Add Exit status operators (bobbyiliev#35)
1 parent 074fb11 commit 81756aa

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ebook/en/content/009-bash-conditional-expressions.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,17 @@ As with other programming languages you can use `AND` & `OR` conditions:
170170
[[ test_case_1 ]] && [[ test_case_2 ]] # And
171171
[[ test_case_1 ]] || [[ test_case_2 ]] # Or
172172
```
173+
174+
## Exit status operators
175+
176+
* returns true if the the command was successful without any errors
177+
178+
```bash
179+
[[ $? -eq 0 ]]
180+
```
181+
182+
* returns true if the the command was not successful or had errors
183+
184+
```bash
185+
[[ $? -gt 0 ]]
186+
```

0 commit comments

Comments
 (0)