tumble.sh

Tony's Wiki | bash

A script to post to tumblr with bash, vim, and curl:

#!/bin/bash
 
# post to tumblr from bash cli with curl
 
# change these to your relevant data:
username=USERNAME
email=EMAIL
password=PASSWORD
 
filedate=$(date +%m%d%y%H%M%S)
 
read -p "Enter a post title: " ttitle
 
vim $filedate.tpost
 
read -p "Enter tags: " ttags
 
pbody="$(cat $filedate.tpost)"
 
login=$(curl -u $username:$password -d "email=$email" http://www.tumblr.com/api/authenticate)
 
if [[ $(curl -s -d "email=$email&password=$password&type=regular&generator=tumble.sh&title=$ttitle&tags=$ttags&body=$pbody" http://www.tumblr.com/api/write | grep error) ]]; then
	echo "Too bad, FAIL!"
else
	echo "Yeah! Tumbled!"
fi
 
mv $(pwd)/$filedate.tpost ~/Documents/fposts/
 
read -p "Shall we have a look? (y or n): " bro
if [ $bro = y ]; 
then
	xdg-open http://USERNAME.tumblr.com
fi
exit

My tumblr is http://tonybaldwin.tumblr.com/

tonybaldwin 2012.01.03.22.18


Tony's Wiki | bash


~~DISQUS~~