#!/usr/bin/env bash # Simple, minimalist command line tool to post status to hubzilla via the API. Requires curl. # Put it in your path, and sneeze your statuses to the zot network from your shell. CONF=${HOME}/.streams_post usage () { echo "usage: util/streams_post [conffile]" echo "Create a conf file, either in .streams_post in your home directory, or supplied as an arg" echo " USER=youruserame " echo " PASS=yourpass" echo " SITE=your.site.domain.org" echo echo "Type \"util/streams_post\" (with or without a conf file as an arg), then enter your message. Use ctrl-D to send.." } CUR=`which curl` [ "$CUR" ] || { echo "curl is not installed or on your path"; usage; exit 1; } [ "$1" ] && CONF="$1" . ${CONF} [ "$USER" ] || { echo "no USER"; usage; exit 1; } [ "$PASS" ] || { echo "no PASS"; usage; exit 1; } [ "$SITE" ] || { echo "no SITE"; usage; exit 1; } echo "enter your message to be posted as $USER @ $SITE, then hit Ctrl-D to send." MSG=$(cat) curl -ssl -u${USER}:${PASS} --data-urlencode "body=${MSG}" https://${SITE}/api/z/1.0/item/update