#!/bin/bash BOARD_NAME=$1 THREAD_NAME=$2 THREAD_BOARD_PATH="/opt/threadcat" if [ -z "${THREAD_NAME}" ]; then THREAD_NAME=$BOARD_NAME BOARD_NAME="" THREAD_PATH="/opt/threadcat/$THREAD_NAME" else THREAD_BOARD_PATH="/opt/threadcat/$BOARD_NAME" THREAD_PATH="/opt/threadcat/$BOARD_NAME/$THREAD_NAME" fi if [ ! -z "${THREAD_NAME}" ]; then cat - | ssh $THREADCAT_USER "umask 002 && mkdir -p $THREAD_BOARD_PATH && echo >> $THREAD_PATH && echo $THREADCAT_USER -- `date` >> $THREAD_PATH && cat - >> $THREAD_PATH" echo "Posted to $BOARD_NAME/$THREAD_NAME" else echo You did not provide a thread name. echo USAGE: "cat YOURMESSAGE | threadcat write [BOARD] THREAD" fi