if not, install it with "yum" or "apt-get".

Create a new script with your favorite editor, i like vi
# vi /usr/bin/tweet (as root user)
and copy the next lines to it.
#!/bin/sh
tweet="${@}"
user="USER"
pass="PASSWORD"
if [ $(echo "${tweet}" | wc -c) -gt 140 ]; then
echo "FATAL: The tweet is longer than 140 characters!"
exit 1
fi
curl -k -u ${user}:${pass} -d status="${tweet}" https://twitter.com/statuses/update.xml >/dev/null 2>&1
if [ $? == "0" ]; then
echo "Successful tweet!"
fiChange the USER to your user name and the PASSWORD to your twitter password.
save and run the command:
# chmod +x /usr/bin/tweet
that's it.
run from your command line
# tweet "Testing tweet sctipt"
and you are twitting.
Great script, but each time I try I get the following:
ReplyDelete[: 16: 127: unexpected operator
Anything I may have done wrong?
Hi Chris,
ReplyDeleteThanks for your comment.
I changed the script a bit, please try it now and let me know if it works for you.
Regards.