#!/bin/bash # Configuration AA_SERVER=[COLLECTION SERVER] RSID=[RSID] ORG_ID=[ORG ID] ECID_JSON="ecid.json" COOKIE_JAR="cookies.txt" # # Check needed programs # type jq >/dev/null 2>&1 if [ $? -ne 0 ] ; then echo >&2 "This script requires 'jq'. Install it before proceeding." exit 1 fi type curl >/dev/null 2>&1 if [ $? -ne 0 ] ; then echo >&2 "This script requires 'curl'. Install it before proceeding." exit 1 fi # # Check for ecid.json # if [ ! -r "$ECID_JSON" ] ; then echo >&2 "Missing ECID. Run ecid.json before proceeding." exit 1 fi # # URL encoding # See: https://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command # function rawurlencode { local string="${1}" local strlen=${#string} local encoded="" local pos c o for (( pos=0 ; pos