#!/bin/bash set -o errexit set -o nounset set -o pipefail source "$(dirname "$0")/../pds.env" # PDS_HOSTNAME= # curl a URL and fail if the request fails. function curl_cmd_get { curl --fail --silent --show-error "$@" } # curl a URL and fail if the request fails. function curl_cmd_post { curl --fail --silent --show-error --request POST --header "Content-Type: application/json" "$@" } # curl a URL but do not fail if the request fails. function curl_cmd_post_nofail { curl --silent --show-error --request POST --header "Content-Type: application/json" "$@" } USERNAME="${1:-}" if [[ "${USERNAME}" == "" ]]; then read -p "Enter a username: " USERNAME fi if [[ "${USERNAME}" == "" ]]; then echo "ERROR: missing USERNAME parameter." >/dev/stderr echo "Usage: $0 ${SUBCOMMAND} " >/dev/stderr exit 1 fi SESS_RESULT="$(curl_cmd_post \ --data "$(cat <