With xargs:
curl localhost:8082/connectors | jq .[] | xargs -L1 -I'{}' curl -XDELETE 'localhost:8082/connectors/{}'
Or equivalently, to show the output of this first curl:
echo '["quickstart-file-sink4","quickstart-file-source","quickstart-file-sink","quickstart-file-sink2","quickstart-file-sink3","quickstart-file-source2"]' | jq .[] | xargs -L1 -I'{}' curl -XDELETE 'localhost:8082/connectors/{}'
jq .[] removes one level of content so that the list becomes output as one line per element.
xargs -L1 processes one line at a time
xargs -I'{}' indicates that the line {} should be replaced by the input line when the next command is called.
xargs is essentially a mapping operator for the shell.
source share