Code:
#!/bin/bash
MYBBUSER=""
POSTKEY=""
TID=0
SUBJECT=""
while [ "$1" != "" ]; do
case $1 in
-t | --thread | --tid )
shift
TID=$1
;;
-s | --sub | --subject )
shift
SUBJECT=$1
;;
* )
break
;;
esac
shift
done
MESSAGE=$@
if [ $TID -eq 0 ]; then
echo "Kein Thread angegeben. Bitte gib einen Thread mit -t an."
exit 1;
fi
if [ "$SUBJECT" != "" ]; then
SUBJECT="--data-urlencode \"subject=RE: $SUBJECT\""
fi
if [ "$MESSAGE" == "" ]; then
read -d "" MESSAGE
fi
curl "http://www.bronies.de/newreply.php" -H "Cookie: mybbuser=$COOKIE;" --data "my_post_key=$POSTKEY&action=do_newreply&tid=$TID&method=reply&postoptions%5Bsignature%5D=1" $SUBJECT --data-urlencode "message=$MESSAGE"