Bash function to post to Twitter via command line

####################################################### Twitter # Usage: # # Twitter I am eating sushi right now # Twitter() { local USERNAME=myusername local PASSWORD=mypassword

# Verify that you have URI::Escape perl module. if perl -MURI::Escape -e exit; then true else echo "perl Module URI::Escape missing. You need to install it." 1>&2 return 1 fi

MESSAGE=$(echo -n "$@" | perl -MURI::Escape -ne 'print uri_escape( $_ )')

COMMAND="curl --basic --user $USERNAME:$PASSWORD --data-ascii status=$MESSAGE

formatting link
" $COMMAND > /dev/null 2>&1 && echo Success. }

Reply to
Ignoramus23425
Loading thread data ...

Now I know why they call it twit (ter) ;)

Reply to
Wes

status=$MESSAGE

formatting link
"> $COMMAND > /dev/null 2>&1 && echo Success.

Nice and simple -- but I would have added a test to make sure that the username and password had been set to something other than the defaults you have in there. Or perhaps able to read them from a file like ~/.twitter/accountname so you could use it for mutiple accounts by typing "twitter junque I am eating sushi right now" and it would read the username and password for account "junque" before proceeding.

Now -- all I need to do is to create a twitter account -- and find people who are interested enough in my day-to-day minutiae to read it. :-)

Thanks, DoN.

Reply to
DoN. Nichols

status=$MESSAGE

formatting link
">> $COMMAND > /dev/null 2>&1 && echo Success.

This is what I do, I have a file ~/.../.../twitter.txt with username and password. It is secret. My family shares my .bashrc, so I cannot have my twitter password there (which is unique and is not used on any other website), but I have it in a secret file.

Well, when posting your minutiae is as easy as typing something on command line, you may reconsider.

Reply to
Ignoramus3943

[ ... ]

O.K. That will work.

That deals with the ease part, but I can't imagine that anybody is interested in what I just ate. Now for metalworking perhaps, but I would rather do the work than type about it like that. (And when I *do* describe it, it tends to be too many characters for twitter to accept.

I don't think that I would follow *anyone* here's tweets. I don't *care* what anybody has for breakfast, and for the things which I

*do* care about -- I would want more detail than would be practical.

Enjoy, DoN.

Reply to
DoN. Nichols

Well, it is up to you as to what you post. I am not sure myself if I want to use it or not. But, I would imagine that twittering about a big project in progress is kind of fun to follow, frmo the rec.crafts.metalworking perspective.

Reply to
Ignoramus764

(...)

-- and

We've been here all along, DoN.

--Winston

Reply to
Winston

Say you have a dicey medical exam today and the whole family wants to know about the results. A few tweets as things progress and everybody (your family members) knows what's happening.

You're at a job site and you don't have the proper part on your truck. One tweet alerts all fellow coworkers about what you need and where you are located. Who ever has it and is close by can respond...

Most of what I see Twitter being used for so far is pretty worthless.

Reply to
Leon Fisk

You haven't been *exposed* to my day-to-day minutiae. :-)

"Cat boarded lap. Kneaded cat's tummy for half an hour. Cat got bored."

Enjoy, DoN.

Reply to
DoN. Nichols

O.K. That would work -- if they knew about the twitter account to start with. Remember -- all of my siblings are now old farts, and I'm the techno-geek of the family. :-)

Hmmm ... about all these workers visiting twitter all day. Not sure about that. (Unless there is a way to set it up to call all their cell phones when you tweet.)

That or beyond it. :-)

Enjoy, DoN.

Reply to
DoN. Nichols

Same problem here, the other parties don't even have a computer...

There is a cell phone interface/application for it I understand. I don't know how it works though, no cell phone to play with and I don't know anyone with a cell geeky enough to try it.

The cell phone part (depending upon how it works) is the only practical side to it I can see. It (Twitter) could create a nice bridge between the two very different worlds (computer to cell phone).

Reply to
Leon Fisk

You are supposed to use the walkie talkie function on your blackberry for that. Use the right technology for crying sakes. I'm going to have to route you to detention. ;)

Wes

-- We are living in the society that Ayn Rand warned us about in 1957.

Reply to
Wes

When Nextel first came online in my area (~1997) with their "Push to Talk" mantra a lot of contractors switched over, replacing their two-way radios. When their first months billing hit they went ballistic. Unit-to-unit was included, one to all was an extra charge. Some of the guys had racked up bills around $500 between that and their extra phone minutes.

Reply to
Leon Fisk

That would be a refreshing change from say, half the postings I read! :)

--Winston

Reply to
Winston

Reply to
James Waldby

James Waldby wrote: (...)

Heh! Cool!

Hmm. How can I use this...

--Winston

Reply to
Winston

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.