Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
using two variables i and j together in 'for' - bash
I guess it can be done with for and while loops. Is there a way to use multiple variables in a single line like this (&& is not working here)
for i in `cat file1` && j in `cat fil2` ; do command $i $j ; done
I am trying to pick i and j simultaneously and execute a command using their values. Curious about how two variables can be used with a single for loop. Any help will be appreciated. Thanks!
Is this what you want?
exec 3< "$file1" exec 4< "$file2" while read a <&3; read b <&4 do ## do something here with $a and $b, e.g.: printf "%-20s %s\n" "$a" "$b" done