# 7. 测试

## 本章目录

* [7.1 测试结构](/shell/part2/07_tests/07_1_test_constructs.md)
* [7.2 文件测试操作](/shell/part2/07_tests/07_2_file_test_operators.md)
* [7.3 其他比较操作](/shell/part2/07_tests/07_3_other_comparison_operators.md)
* [7.4 嵌套 if/then 条件测试](/shell/part2/07_tests/07_4_nested_if_then_condition_tests.md)
* [7.5 牛刀小试](/shell/part2/07_tests/07_5_testing_your_knowledge_of_tests.md)

每一个完备的程序设计语言都可以对一个条件进行判断，然后根据判断结果执行相应的指令。Bash 拥有 [`test`](http://tldp.org/LDP/abs/html/testconstructs.html#TTESTREF) 命令，[双方括号](http://tldp.org/LDP/abs/html/testconstructs.html#DBLBRACKETS)、[双圆括号](http://tldp.org/LDP/abs/html/testconstructs.html#DBLPARENSTST) 测试操作符以及 `if/then` 测试结构。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.clay-wangzhi.com/shell/part2/07_tests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
