Привет, у меня есть два текстовых файла: boy.txt и girl.txt
значения из boy.txt:
12345678
87654321
значения из girl.txt:
35f1f125-5d33-44a4-82fc-26734843c804
5abd0360-c4be-4e69-8085-340755f87290
Я должен использовать эти два значения внутри команды curl, это моя команда:
readarray boy < boy.txt
readarray girl < girl.txt
count=0
for i in ${girl[@]}
do
result[${boy[${count}]}]=${i}
count=$((count+1))
for output1 in ${!result[@]}; do
output2=${result[$output1]};
echo "curl -X PUT
--header \"Content-Type: application/json\"
--header \"Accept: application/json\"
--header \"Authorization: Bearer gAAAAJ1EY28EHByJCcgT-sWhzid- cxW1uQrfO1QJG52D4n9GYj9YWd4KUGBSxO2LXZ48eEbQivSAlM6bplNE82o84UFnkwiVJ0V1q4DM9VAHw6jU4UvkdhhSrlupC6gKl_RHEgf2cluwvAN11My7eFflA-JnBrINp02d146CaJrR_r52hAEAAIAAAAAXmL1IDoHPz3S5deta0ygANUUoEFBsuKHaeDo3NXVUptxxDXR00yaNmILqd1psJckYhrBhh7wdQNdNYaSsqgwsF8Nuw_hhUAbg27hhGaVLmbeK3eS3mtVlq1D73Vg3KSk-24DmR0o-jT2u88k4MLfkqxuipEsLAEcSoe4zAPE1jcch2GGvlNWTHN98gMxw-svmvu6hizZ1fe-pWNtMGwa9u_hVimOr8A-7HcidA4Sj_jBprulGUapifc-Dd_qZFj1FM1HedHvnu8NKzp_uRr8z_Myk0IO6RyqjPPufLdafV3N4hmEqVex8P8jr4SkZWT0f-4i1epfZcRJmz6ognOCfaxa91c3qFNpG3IVY881g9aCPdLOxmU5FqKDPgHIZLvp8wWeTWdi_YQaAXMUh-yZQXBLhBimG8SR2iRj6ZTvu_L_Ytmc0QePkaijA6CB8wY2SbHlOGL2JUcEXKoNjC9dSSbkHqWx0tXMR2XCCdlhHPC1vGYcCgV-XQ_bfqgN7yn8\"
-d \"\\"\"referenceId:"$output2"\\"\"\" \"https://website.com:443/testing/api/devices/"$output1"/parentPath\" " > test.sh
done
done
chmod+x test.sh
./test.sh
Вывод команды выше:
проблема в том, что вместо двух
отображается только одна команда curl
curl -X PUT
--header "Content-Type: application/json"
--header "Accept: application/json"
--header "Authorization: Bearer gAAAAJ1EY28EHByJCcgT-sWhzid-cxW1uQrfO1QJG52D4n9GYj9YWd4KUGBSxO2LXZ48eEbQivSAlM6bplNE82o84UFnkwiVJ0V1q4DM9VAHw6jU4UvkdhhSrlupC6gKl_RHEgf2cluwvAN11My7eFflA-JnBrINp02d146CaJrR_r52hAEAAIAAAAAXmL1IDoHPz3S5deta0ygANUUoEFBsuKHaeDo3NXVUptxxDXR00yaNmILqd1psJckYhrBhh7wdQNdNYaSsqgwsF8Nuw_hhUAbg27hhGaVLmbeK3eS3mtVlq1D73Vg3KSk-24DmR0o-jT2u88k4MLfkqxuipEsLAEcSoe4zAPE1jcch2GGvlNWTHN98gMxw-svmvu6hizZ1fe-pWNtMGwa9u_hVimOr8A-7HcidA4Sj_jBprulGUapifc-Dd_qZFj1FM1HedHvnu8NKzp_uRr8z_Myk0IO6RyqjPPufLdafV3N4hmEqVex8P8jr4SkZWT0f-4i1epfZcRJmz6ognOCfaxa91c3qFNpG3IVY881g9aCPdLOxmU5FqKDPgHIZLvp8wWeTWdi_YQaAXMUh-yZQXBLhBimG8SR2iRj6ZTvu_L_Ytmc0QePkaijA6CB8wY2SbHlOGL2JUcEXKoNjC9dSSbkHqWx0tXMR2XCCdlhHPC1vGYcCgV-XQ_bfqgN7yn8"
-d "\"referenceId:35f1f125-5d33-44a4-82fc-26734843c804\"" "https://webite.com:443/testing/api/devices/12345678/parentPath"
Мой ожидаемый результат:
отобразить команду в файле .sh
curl -X PUT
--header "Content-Type: application/json"
--header "Accept: application/json"
--header "Authorization: Bearer gAAAAJ1EY28EHByJCcgT-sWhzid-cxW1uQrfO1QJG52D4n9GYj9YWd4KUGBSxO2LXZ48eEbQivSAlM6bplNE82o84UFnkwiVJ0V1q4DM9VAHw6jU4UvkdhhSrlupC6gKl_RHEgf2cluwvAN11My7eFflA-JnBrINp02d146CaJrR_r52hAEAAIAAAAAXmL1IDoHPz3S5deta0ygANUUoEFBsuKHaeDo3NXVUptxxDXR00yaNmILqd1psJckYhrBhh7wdQNdNYaSsqgwsF8Nuw_hhUAbg27hhGaVLmbeK3eS3mtVlq1D73Vg3KSk-24DmR0o-jT2u88k4MLfkqxuipEsLAEcSoe4zAPE1jcch2GGvlNWTHN98gMxw-svmvu6hizZ1fe-pWNtMGwa9u_hVimOr8A-7HcidA4Sj_jBprulGUapifc-Dd_qZFj1FM1HedHvnu8NKzp_uRr8z_Myk0IO6RyqjPPufLdafV3N4hmEqVex8P8jr4SkZWT0f-4i1epfZcRJmz6ognOCfaxa91c3qFNpG3IVY881g9aCPdLOxmU5FqKDPgHIZLvp8wWeTWdi_YQaAXMUh-yZQXBLhBimG8SR2iRj6ZTvu_L_Ytmc0QePkaijA6CB8wY2SbHlOGL2JUcEXKoNjC9dSSbkHqWx0tXMR2XCCdlhHPC1vGYcCgV-XQ_bfqgN7yn8"
-d "\"referenceId:35f1f125-5d33-44a4-82fc-26734843c804\"" "https://webite.com:443/testing/api/devices/12345678/parentPath"
curl -X PUT
--header "Content-Type: application/json"
--header "Accept: application/json"
--header "Authorization: Bearer gAAAAJ1EY28EHByJCcgT-sWhzid-cxW1uQrfO1QJG52D4n9GYj9YWd4KUGBSxO2LXZ48eEbQivSAlM6bplNE82o84UFnkwiVJ0V1q4DM9VAHw6jU4UvkdhhSrlupC6gKl_RHEgf2cluwvAN11My7eFflA-JnBrINp02d146CaJrR_r52hAEAAIAAAAAXmL1IDoHPz3S5deta0ygANUUoEFBsuKHaeDo3NXVUptxxDXR00yaNmILqd1psJckYhrBhh7wdQNdNYaSsqgwsF8Nuw_hhUAbg27hhGaVLmbeK3eS3mtVlq1D73Vg3KSk-24DmR0o-jT2u88k4MLfkqxuipEsLAEcSoe4zAPE1jcch2GGvlNWTHN98gMxw-svmvu6hizZ1fe-pWNtMGwa9u_hVimOr8A-7HcidA4Sj_jBprulGUapifc-Dd_qZFj1FM1HedHvnu8NKzp_uRr8z_Myk0IO6RyqjPPufLdafV3N4hmEqVex8P8jr4SkZWT0f-4i1epfZcRJmz6ognOCfaxa91c3qFNpG3IVY881g9aCPdLOxmU5FqKDPgHIZLvp8wWeTWdi_YQaAXMUh-yZQXBLhBimG8SR2iRj6ZTvu_L_Ytmc0QePkaijA6CB8wY2SbHlOGL2JUcEXKoNjC9dSSbkHqWx0tXMR2XCCdlhHPC1vGYcCgV-XQ_bfqgN7yn8"
-d "\"referenceId:5abd0360-c4be-4e69-8085-340755f87290\"" "https://webite.com:443/testing/api/devices/87654321/parentPath"
Или, если у вас есть способ (правильный синтаксис), чтобы я мог скручиваться напрямую, очень признателен.