88a39f750a
Initial commit
12 lines
447 B
Text
12 lines
447 B
Text
#/bin/bash
|
|
PATH=YOUR-PATH
|
|
|
|
# Calculate number of entries in json datafile
|
|
MAXNUMBER=$(/YOUR-PATH-TO-JQ/jq '.[].post' /posts.json | wc -l)
|
|
|
|
# Fetch random entry from json datafile
|
|
QUOTE=$(/YOUR-PATH-TO-JQ/jq --argjson randomnumber $((RANDOM % $MAXNUMBER)) '.[$randomnumber].post' /YOUR-PATH/posts.json)
|
|
QUOTE="status=${QUOTE}"
|
|
|
|
# Go!
|
|
/usr/bin/curl -g https://YOUR-INSTANCE.TLD/api/v1/statuses -H 'Authorization: Bearer YOUR-ACCESS-KEY' -F "$QUOTE"
|