Skip to content

Instantly share code, notes, and snippets.

@mikequentel
Created December 5, 2014 04:06
Show Gist options
  • Save mikequentel/8449b69b411969444007 to your computer and use it in GitHub Desktop.
Save mikequentel/8449b69b411969444007 to your computer and use it in GitHub Desktop.
#!/bin/bash
# BWTU (Bash-Wget-Twitter-Updater)
# DATE AND TIME.
CURRENT_DATE=$(date "+%A %Y%m%d %H:%M:%S")
UTC_DATE=$(date -u "+%A %Y%m%d %H:%M:%S")
# CD TO /var/tmp
cd /var/tmp
# READ IN LOGIN INFO.
echo -n "username: "
read -e USER
echo -n "password: "
stty -echo
read -e PASSWD
stty echo
echo
# WHILE LOOP -- CTRL+C TO BREAK.
echo "Enter ctrl+c to exit..."
while true; do
# READ IN STATUS COMMENT.
echo
echo -n "Enter status update to Twitter: "
read -e STATUS
# DO wget OF STATUS UPDATE TO TWITTER.
wget -O /dev/null -o /dev/null --http-user=$USER \
--http-password=$PASSWD --post-data "status=$STATUS \
-- $UTC_DATE UTC / $CURRENT_DATE LOCAL" \
http://twitter.com:80/statuses/update.xml
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment