# Shell while

\#Brief bash shell 中主要提供了三种循环:for,while,until

```shell
#！/bin/bash
while [ condition ]
do
   command1
   command2
   command3
done
```

\#Command 自动生成随机数，用于测试实时推荐系统使用

```shell
#！/bin/bash
while true
do
    echo $(($RANDOM%10+1)) >> top.log
    sleep 3
done
```


---

# 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://jimmy-walker.gitbook.io/linux-shell/shell-brief/shell-while.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.
