Lucas Vieites .com Logo
Lucas Vieites .com
«I intend all my puns»

bash "for" loop in one line

 
for i in $(seq 1 4); do echo $i; done

will output:

1 2 3 4

Here's a more practical example to run a command for every file returned by the ls command:

for FILE in $(ls *.zip); do unzip $FILE; done

Author:   ✦  Published:   ✦  Updated:   ✦