Help with 3 variable bash loop

view full story

http://www.unix.com – Hi all! I think someone might be able to solve my problem pretty easily. I am trying to run a bash loop with 3 variables. I know how to do: Code: for var1 in `cat list1`; do for var2 in `cat list2`; do for var3 in `cat list3`; command var1 var2 > var3; done; done; done However, this will run all permutations between the three variables. So if I have three files defining var1, var2 and var3, I only want the first line from each file to run in loop1, then the second line of each file to run for loop2, etc.... So if each file as 10 variables, the loop will run 10 times: first iteration (HowTos)