Created
August 26, 2010 06:02
-
-
Save josue/550905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# file: tweet | |
# NOTE: make sure to put this file in '/usr/bin' and make it executable: sudo chmod +x /usr/bin/tweet | |
# usage: tweet "hello from CLI" | |
user="USERNAME" | |
pass="PASSWORD" | |
tweet=$1 | |
echo | |
curl -o /tmp/tweet --basic --user "$user:$pass" --data-ascii "status=$tweet" http://twitter.com/statuses/update.json > /dev/null 2>&1 | |
tweet_sent=$(grep -c "created_at" /tmp/tweet) | |
[ "$tweet_sent" -eq "1" ] && echo "Tweet sent" || echo "Error, not sent." | |
[ -f /tmp/tweet ] && rm -f /tmp/tweet | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update: the script no longer works because Twitter stop supporting BASIC AUTH login.