Project

General

Profile

Download (639 Bytes) Statistics
| Branch: | Tag: | Revision:
#!/bin/bash
ADDRESS="brutus"
PORT="8081"

if [ "$#" -ne 2 ]; then
echo "USAGE: hbkcd_add <path to input file> <path to output file/directory>"
exit -1
fi

# Make sure curl ad jq are installed
command -v curl >/dev/null 2>&1 || { echo >&2 "Please install curl to use this script. Aborting."; exit 1; }
command -v jq >/dev/null 2>&1 || { echo >&2 "Please install jq to use this script. Aborting."; exit 1; }

INPUT_PATH=$(readlink -f "$1")
#~ echo '{"type": "add", "path": "'"$INPUT_PATH"'", "output": "'"$2"'"}'

curl -s -d '{"type": "add", "path": "'"$INPUT_PATH"'", "output": "'"$2"'"}' -X POST http://$ADDRESS:$PORT/command | jq
(1-1/4)