Im doing a bash script where I use a for loop in order to get some information using a AWS command, the output of the command is a list in Json so, i'm using jq for filtering the response. As I'm expecting to pass the output of the first command to another i need to send each element of the list individually and here is where I'm in troubles.
for i in {0..1}
do
aws ecs list-tasks --cluster $1 --profile $2 | jq '.taskArns[$i]'
done
It doesn't matter how I set the for, if I set it as for i in {0..1} or for i in "${tasks[@]}" when I run the script it give back the same error, however if I put the index as taskArns[0] or taskArns[1] the script works.
Thanks in Advice!