1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#! /bin/sh set -euf cac-listservers \ | jq \ --arg k "$1" \ --arg v "$2" \ ' map(select(.[$k]==$v)) | if (. | length) == 1 then .[0] else . end '