💾 Archived View for freeshell.de › tldr › for.gmi captured on 2024-02-05 at 10:57:40. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-04-28)

-=-=-=-=-=-=-

for

Perform a command several times.

More information.

for {variable} in {item1 item2 ...}; do {echo "Loop is executed"}; done
for {variable} in {{from}..{to}..{step}}; do {echo "Loop is executed"}; done
for {variable} in {path/to/file1 path/to/file2 ...}; do {echo "Loop is executed"}; done
for {variable} in {path/to/directory1/ path/to/directory2/ ...}; do {echo "Loop is executed"}; done
for {variable} in */; do (cd "${variable}" || continue; {echo "Loop is executed"}) done
Copyright © 2014—present the tldr-pages team and contributors.
This work is licensed under the Creative Commons Attribution 4.0 International License (CC-BY).

CC-BY