# Converts your string to a bash array
SAVEIFS=$IFS # Save current IFS (Internal Field Separator)
IFS=' ' # Change IFS to space
array=($regions) # split the `regions` string into an array
IFS=$SAVEIFS # Restore original IFS
# Converts the bash array to a json array
json_array=$(printf '%s\n' "${array[@]}" | jq -R . | jq -s .)
$ Format the output as Script Filter Json Format
jq -n --argjson item "$json_array" -f <(echo '{"items":[$item[] as $name | {"uid":$name,"title":$name,"arg":$name,"autocomplete":$name,"icon":{"path":("icons/" + $name + ".png")}}]}')