by gcmeplz · 5y ago · 0 comments
stuff=("foo" "bar" "baz");
array_length=${#stuff[@]};
for i in $(seq 0 $array_length); do
curl localhost:8080/${stuff[i]}
done
I'm betting even that isn't right: as soon as bash arrays are a thing, I reach for a different language.[edit]: trying to get formatting correct
However, your technique also works, with some tweaks:
* The loop goes one index too far, and can be fixed with seq 0 $(( array_length - 1 ))
* There should be quotes around ${stuff[i]} in case it has spaces