for a in {P02183606,P02183608}
do
for b in {PID,PID2}
do
curl -i -H "Authorization:Token sample" "Content-type: application/json" -X GET "http://mastindia//project/push?applicationRefNo=$a&applicationFormId=$b"
done;
done;
Expected Output Service should call 2 times not 4 times.(Issue is only $a and $ b values should be below)
http://applicationRefNo=P02183606&applicationFormId=PID
http://applicationRefNo=P02183608&applicationFormId=PID2
A nested for loop will always run n*n2 times.
In your case, there is no need to nest the loop, you can just do it like this:
#bin/bash
whatever=("P02183606" "PID" "P02183608" "PID2");
for((i = 0; i<${#whatever[@]}; i=i+2));
do
curl -i -H "Authorization:Token dont share it ffs" "Content-type: application/json" -X GET "http://indiafirstlife.com//onlineInsurance-rest/uploadDocument/uploadDocumentsOmniMannualPush?applicationRefNo=${whatever[i]}&applicationFormId=${whatever[i+1]}"
echo "Accessing: http://indiafirstlife.com/onlineInsurance-rest/uploadDocument/uploadDocumentsOmniMannualPush?applicationRefNo=${whatever[i]}&applicationFormId=${whatever[i+1]}"
done
Output:
Accessing: http://indiafirstlife.com/onlineInsurance-rest/uploadDocument/uploadDocumentsOmniMannualPush?applicationRefNo=P02183606&applicationFormId=PID
Accessing: http://indiafirstlife.com/onlineInsurance-rest/uploadDocument/uploadDocumentsOmniMannualPush?applicationRefNo=P02183608&applicationFormId=PID2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.