2016-01-05 18:47:12 +00:00
|
|
|
# while
|
|
|
|
|
2016-01-13 11:04:46 +00:00
|
|
|
> Simple shell loop.
|
brightness, n, open, pbcopy, pbpaste, rename, route, rubocop, softwareupdate, timed, where, while, xed, xip: add link (#7831)
2022-03-01 13:21:17 +00:00
|
|
|
> More information: <https://manned.org/while>.
|
2016-01-05 18:47:12 +00:00
|
|
|
|
2021-01-31 17:05:18 +00:00
|
|
|
- Read stdin and perform an action on every line:
|
2016-01-05 18:47:12 +00:00
|
|
|
|
|
|
|
`while read line; do echo "$line"; done`
|
|
|
|
|
2016-01-13 11:04:46 +00:00
|
|
|
- Execute a command forever once every second:
|
2016-01-05 18:47:12 +00:00
|
|
|
|
|
|
|
`while :; do {{command}}; sleep 1; done`
|