#!/bin/bash # Copyright (C) 2007 Michael Homer <=mwh> # Distributed under the GNU GPLv3+ and without warranty of any kind. [ "$*" ] || exit 1 # A tweet is required, so quit if there's none. . ~/.twitter && [ "$EMAIL" ] || { echo -n "Enter your email address used on twitter: " read EMAIL echo -n "Enter your twitter password: " read PASSWORD echo -e "EMAIL=$EMAIL\nPASSWORD=$PASSWORD" > ~/.twitter echo "Saved credentials to ~/.twitter" } # Post the tweet. This URL encoding is overkill and %-encodes every character. curl -d "status=%$(echo -n "$@"|od -tx1 -A n -v|xargs echo|tr ' ' %)" \ -u $EMAIL:$PASSWORD -s -o /dev/null http://twitter.com/statuses/update.xml echo "Tweeted."