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

Category: Bash Scripting

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

Loop over all .txt files in current directory

Loops over every .txt file in the current directory, running a command for each.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.