Logo
Web01
Ch4os1@web01:~/commands/for
← View all bash commands

for

for loop to iterate over a list of items.

Examples

for i in {1..5}; do echo $i; done
              

Print numbers 1 to 5.

for file in *.txt; do echo $file; done
              

List all .txt files in the current directory.

Notes

This command affects only the current shell session.