#!/usr/bin/env bash DEBUG="0" ROUTEROS_HOST="$1" USERNAME="$2" PASSWORD="$3" SCRIPT_NAME="$4" SCRIPT_FILENAME="$5" if [ ! -z "${SCRIPT_NAME}" ] then if [ ! -f "${SCRIPT_FILENAME}" ] then echo "The file [ \"${SCRIPT_FILENMAE}\" ] is missing" >&2 exit 1 fi DATA=$( ruby text-file-to-json.rb ${SCRIPT_NAME} ${SCRIPT_FILENAME} ) ADD_RES=$(\ curl -q -k -u ${USERNAME}:${PASSWORD} -X POST "https://${ROUTEROS_HOST}/rest/system/script/add" \ -H "content-type: application/json" \ --data "${DATA}" \ ) echo "${ADD_RES}" fi