zsh sleep assistance with loop
You are using the short form of the for
loop, so that only the { curl ... }
command forms the body of the loop; sleep 1
occurs after the for
loop. Instead, ensure that the sleep
command is in the body of the for
loop with
while truedo for p in **/*.xml; do curl -X POST -H "Content-Type:application/xml" -d @"${p}" "https://url/postAPI" > "post_${p}" sleep 1 donedone
(You could also put sleep 1
inside the {...}
construct that forms the body of the short-form for
loop, but I recommend avoiding that form except for quick, one-off loops in interactive shells.)