I have seed file with below content.
$cat seed.txt
macmachine,192.168.2.4,29772
windowsmachine,192.168.2.5,29772
$
When I run for loop first $x will cat first field of first line that is macmachine from seed file and "do" run second for loop and this will cat second field of first line and so on...
Here is my for loop
for x in `cat seed.txt |cut -d ',' -f1`; do
for y in `cat seed.txt |cut -d ',' -f2`; do
curl -v -H -X GET -H "X-TEST-Request-Id: Domain-$x" http://$y:8080/static/test/$y.jsp;
done;
done
The problem is it runs 8 times. If I remove first line from seed file it will run only once.
I'm sure something is wrong with the loop, but I'm not able to trace that. Please suggest how to fix it.
for z incat seed.txt |cut -d ',' -f3; docat(UUoC — Useless Use ofcat; search for it);cutis quite capable of reading files.curlexecuted 4 times. The outer loop hasxset tomacmachinethenwindowsmachine; the inner loop hasyset to192.168.2.4and then192.168.2.5. Did you omit a loop onzpicking up the last column? That would give you 8 loops, but the code doesn't show that.cat -A seed.txt