1

Is there a way to make the "write" a nested for-loop that would only call the elements in the lists based on their position.

e.g.

List 1 = {A,B,C}
List 2 = {1, 2,3}

The call would only be

A1 
B2
C3

i.e. 1st element in List_1 would only be called together with the 1st element in List_2, etc.

I have this code

for i in {A,B,C,D}; do for j in {0,1,2,3}; do echo curl -b cookies.txt "https://mydomain(dot)com/${i} -d 'status=0&version=${j}'";done done;

However, this calls all the possible combinations

curl -b cookies.txt https://mydomain(dot)com/A -d 'status=0&version=0'
curl -b cookies.txt https://mydomain(dot)com/A -d 'status=0&version=1'
curl -b cookies.txt https://mydomain(dot)com/A -d 'status=0&version=2'
curl -b cookies.txt https://mydomain(dot)com/A -d 'status=0&version=3'
curl -b cookies.txt https://mydomain(dot)com/B -d 'status=0&version=0'
curl -b cookies.txt https://mydomain(dot)com/B -d 'status=0&version=1'
etc

Where as I would only like the code to call only

curl -b cookies.txt https://mydomain(dot)com/A -d 'status=0&version=0'
curl -b cookies.txt https://mydomain(dot)com/B -d 'status=0&version=1'
curl -b cookies.txt https://mydomain(dot)com/C -d 'status=0&version=2'
curl -b cookies.txt https://mydomain(dot)com/D -d 'status=0&version=3'

Is this possible with a structure similar to what I shared? Thank you

0 Answers0