Skip to content

Instantly share code, notes, and snippets.

@trscavo
trscavo / construct_mdq_url
Last active August 29, 2015 14:05
Bash function to construct a request URL per the Metadata Query Protocol specification
# Construct a request URL per the MDQ Protocol specification
# See: https://github.com/iay/md-query
# To construct a reference to ALL entities served by the
# metadata query server, simply omit the second argument
construct_mdq_url () {
# construct_mdq_url <base_url> <url_encoded_id>
# make sure there are one or two command-line arguments
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "ERROR: $FUNCNAME: incorrect number of arguments: $# (1 or 2 required)" >&2