> For the complete documentation index, see [llms.txt](https://jimmy-walker.gitbook.io/linux-shell/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jimmy-walker.gitbook.io/linux-shell/shell-brief/shell-while.md).

# 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
```
