What's the hottest city?

Hi everyone,
I am doing this off-platform project and am stuck at step five. `#!/bin/bash

cities=(“Paris” “London” “Granada”)

temperatures.txt

for city in ${cities[0]}
do
sleep 1
echo $(./weather.sh -s $city)
done
`
This is what I wrote, it is (I think) exactly as in the provided solution but my terminal keeps displaying that the ‘-s’ option is illegal. Is there a problem with my code or is it the weather.sh that doesn’t provide the simplified option ?

Cheers,
Pierre

I use

for city in ${cities[0]}
do
sleep 1
echo $(weather $city)
done

Did anybody have issues with not being able to get it to actually loop the array? I’ve tried it with a bunch of different cities and it only ever writes the first city of the array to the txt file.

#!/bin/bash
cities=(“London” “Paris” “Tokyo”)

temperatures.txt
for city in ${cities[0]}
do
sleep 1
./weather.sh -s $city | sed ‘s/+//’ | sed ‘s/°F//’ >> temperatures.txt
done
sort -k2 -r temperatures.txt > sorted_temperatures.txt

Thank you!

Realized I was reading the @ symbol as a 0 this whole time, which would return the first item of the array only. :roll_eyes: