#!/bin/bash IPPATH="/usr/local/tomcat" PORT=3456 URL="localhost" PARAM="command=$@" RESULT=$(curl --silent -G -f --data-urlencode "$PARAM" http://$URL:$PORT) STDERR=$(echo $RESULT | jq -r ".stderr") STDOUT=$(echo $RESULT | jq -r ".stdout") CODE=$(echo $RESULT | jq -r ".returncode") >&2 printf "%s" "$STDERR" printf "%s" "$STDOUT" exit $CODE