I have the following script I made using CURL for a task, I want to download several JSON files from different repos, a JSON per language in its corresponding ISO Lang Code. The problem I have is that after running the code, the first Language "bg" in the Array is not downloaded in the corresponding local folder, the rest are downloaded normally. Can anyone point me to what I need to fix? The code is below:
```#!/bin/bash
repo=("repo1" "repo2" "repo3")
lang=("bg" "cs" "da" "de" "el" "en" "en_gb" "en_us" "es" "fi" "fr" "hu" "it" "ja" "nl" "no" "pl" "pt" "ro" "ru" "sk" "sv" "th" "tr" "zh")
for repo in "${repo[@]}"
do
for lang in "${lang[@]}"
do
curl --user "${USER}":"${APP_PASSWORD}" -O "https://api.bitbucket.org/2.0/repositories/<company>/${repo}/<url>/translations/${lang}.json" --output-dir "C:/Mylocalfiles/Curl/${repo}/"
done
done ```
Thanks everyone for your help!
After all your suggestions, I fixed the code, and here's the updated one. it works perfectly!
#!/bin/bash
repo=("repo1" "repo2" "repo3")
lang=("bg" "cs" "da" "de" "el" "en" "en_gb" "en_us" "es" "fi" "fr" "hu" "it" "ja" "nl" "no" "pl" "pt" "ro" "ru" "sk" "sv" "th" "tr" "zh")
for repo_id in "${repo[@]}"
do
for lang_code in "${lang[@]}"
do
curl --user "${USER}":"${APP_PASSWORD}" -O "https://api.bitbucket.org/2.0/repositories/<company>/${repo_id}/<url>/translations/${lang_code}.json" --output-dir "C:/Mylocalfiles/Curl/${repo_id}/"
done
done ```