Skip to content

Instantly share code, notes, and snippets.

@josue
Created August 26, 2010 06:02
Show Gist options
  • Save josue/550905 to your computer and use it in GitHub Desktop.
Save josue/550905 to your computer and use it in GitHub Desktop.
#!/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
@josue
Copy link
Author

josue commented Oct 20, 2010

Update: the script no longer works because Twitter stop supporting BASIC AUTH login.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment