Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
Write an article for LinuxForums Today! Win Great Prizes!
This is a short tutorial explaining how to post to Twitter using command-line in Linux, without needing to even open up your web browser.
First, install the curl package:
sudo apt-get install curl
Next, create a script anywhere in your $PATH, for example twitter.sh inside ~/bin, where ~ is your home directory (make sure ~/bin is included in your $PATHvariable, in case echo $PATH doesn't return it, edit~/.bashrc and add a line like this: export PATH=/home/USER/bin/:$PATH).
The script twitter.sh should contain the following:
User name and password are now visible on your machine, and in any backups.
Maybe the -n option would help a bit.
! unexposed in a command line could be grabbed by the shell to substitute history.
Other special characters will muck up the input.
At least use single quotes for the message on the example:
twitter.sh 'Hello, world! This is a test.'
To fix this, the script could use raw mode and pull characters in one by one.
The attempt could fail and STDERR will go to the terminal, then it will say, "Message sent'
Checking return status would be a good idea.
RE: Good idea but too simple to be practical as is written by iamSpOOk:
Also, slight typing convenience...
writen by: Swillis on 2010-03-23 18:42:40
Just so the new guys/girls know, you don't need the ".sh" extension on the script. So, you could simply name it "twitter", for example, and then just type "twitter YOUR MESSAGE" in the terminal. It's really more of a keystroke saver/personal preference than anything.
RE: Also, slight typing convenience... written by Swillis:
RE: Also, slight typing convenience...
writen by: rockowtham on 2010-06-16 23:17:18
hi i tried this script..,
but its not working for me i m getting the error message as below please help me out
(gedit:12637): GnomeUI-WARNING **: While connecting to session manager:
Authentication Rejected, reason : MIT-MAGIC-COOKIE-1 authentication rejected.
Reply to rockowtham:
Comment title: * please do not put your response text here