#!/bin/sh if [ "$1" = "status" ]; then shift while [ $# -gt 0 ]; do printf "%s" "bla, status, $1" | socat -T1 - udp-datagram:127.0.0.1:9915 | cut -c 5- shift done elif [ "$1" = "exec" ]; then name="$2" shift 2 jq='{}' while [ $# -gt 1 ]; do jq=$( printf "%s" "$jq" | jq --arg key "${1#--}" --arg val "$2" '. += { ($key): $val }' ) shift 2 done echo "Sending:" echo "$jq" printf "%s" "bla, $name, $jq" | socat -T1 - udp-datagram:127.0.0.1:9915 | cut -c 5- else echo "unknown command, try status or exec" exit 1 fi