1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/while.md

13 lines
328 B
Markdown
Raw Normal View History

2016-01-05 20:47:12 +02:00
# while
2016-01-13 12:04:46 +01:00
> Simple shell loop.
2023-08-08 13:21:15 +03:00
> More information: <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_04_09>.
2016-01-05 20:47:12 +02:00
- Read `stdin` and perform an action on every line:
2016-01-05 20:47:12 +02:00
`while read line; do echo "$line"; done`
2016-01-13 12:04:46 +01:00
- Execute a command forever once every second:
2016-01-05 20:47:12 +02:00
`while :; do {{command}}; sleep 1; done`