shell命令请求http嵌套

shell命令请求http嵌套

journal photography
#!/bin/bash

json() {
    curl -s "$1" | jq "$2" | sed 's#"##g'
}

json 'http://localhost:8500/v1/catalog/datacenters' '.[]' | while read dc; do
    json "http://localhost:8500/v1/health/like?dc=${dc}&passing=true" '.[].Node.Address' | while read ip; do
        echo curl -X PATCH "http://${ip}:8080/caches"
        curl -X PATCH "http://${ip}:8080/caches"
    done
done

THEME_QUARK.BLOG.ITEM.NEXT_POST