tldr/pages/common/for.md

13 lines
286 B
Markdown
Raw Normal View History

2016-01-05 18:47:12 +00:00
# for
2016-01-13 11:04:46 +00:00
> Shell loop over parameters.
2021-03-30 08:26:00 +01:00
> More information: <https://man.archlinux.org/man/for.n>.
2016-01-05 18:47:12 +00:00
2016-01-13 11:04:46 +00:00
- Perform a command with different arguments:
2016-01-05 18:47:12 +00:00
`for argument in 1 2 3; do {{command $argument}}; done`
2016-01-13 11:04:46 +00:00
- Perform a command in every directory:
2016-01-05 18:47:12 +00:00
`for d in *; do (cd $d; {{command}}); done`