You are not logged in.

#1 2010-05-12 06:45:52

dsdeiz
Member
Registered: 2009-08-17
Posts: 69

Help creating a Twidge "daemon"..

Hi!

Um, I was just starting out with bash scripting and already thinking of creating a Twidge "daemon".. lol It simply prints out the recent updates..  I was thinking of having the output be like this:

+-------------------------+------------------------------------------+
| another_twitter_user    | Update from another_twitter_user         |
+-------------------------+------------------------------------------+
| twitter_user            | Update from twitter_user....             |
+-------------------------|------------------------------------------+

Would this be somewhat hard? neutral

I have this just as a start while trying to learn bash...

#!/bin/sh

while true; do
  twidge lsrecent -us;
  sleep 2;
done;

It at least just prints out the most recent update... Haha This is what it looks like:

<twitter_user>             Some update from twitter_user...
<another_twitter_user>     Some update from another_twitter_user...

Any help and pointers appreciated! big_smile

Offline

#2 2010-05-12 14:16:49

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: Help creating a Twidge "daemon"..

Obligatory: 0x3A28213A, 0x6339392C, 0x7363682E

I would use Perl, because I don't know bash that well, and in Perl it would be pretty straightforward.  It seems that it wouldn't be too difficult in bash either, but I have little experience to support that impression.

Offline

#3 2010-05-12 21:29:12

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Help creating a Twidge "daemon"..

I don't know much about twidge, but why not just have it write to a fifo so you can tail the fifo.

Offline

#4 2010-05-13 01:21:01

dsdeiz
Member
Registered: 2009-08-17
Posts: 69

Re: Help creating a Twidge "daemon"..

falconindy wrote:

I don't know much about twidge, but why not just have it write to a fifo so you can tail the fifo.

Hi! Thanks for the reply.. By fifo, would you mean "first in, first out"? I'm not quite sure if this would be possible since when I do a sleep for 2 seconds, there are times that in that 2 second span there are more tweets and twidge just outputs them as one big chunk of text that was already formatted..

Someone from #bash spoonfed me with a command. Since the first thing I'd like to do is remove those '<' '>', he gave me this:

${name:1:${name}:-2}
Trent wrote:

I would use Perl, because I don't know bash that well, and in Perl it would be pretty straightforward.  It seems that it wouldn't be too difficult in bash either, but I have little experience to support that impression.

Um, might you be able to share your idea? The one that I can't seem to have an idea on how to format it would be that twidge returns tweets like this:

<twitter_user>             Some update from twitter_user. Some
                           update from twitter_user.

There's a linebreak if a tweet is long but still aligned with the second column.

The same person provided me with another code that separates "name | status".. Although there are times that it becomes "name | status | continuation of status". Will provide it here once I get home to get in hand with my computer.

Thanks for the help again!

Offline

#5 2010-05-13 03:02:58

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Help creating a Twidge "daemon"..

fifo as in the bash command 'mkfifo'. You can create a fifo file which you can cat/echo/barf into. Meanwhile, in another terminal you can run 'tail -f' on the fifo and watch as whatever was sent into the fifo comes out the other side.

Offline

#6 2010-05-13 12:02:40

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: Help creating a Twidge "daemon"..

dsdeiz wrote:

Um, might you be able to share your idea? The one that I can't seem to have an idea on how to format it would be that twidge returns tweets like this:

<twitter_user>             Some update from twitter_user. Some
                           update from twitter_user.

You mean in bash or in Perl?  I don't have time to work it out right now but I can come back and try it later in the day.

Offline

#7 2010-05-15 02:10:42

dsdeiz
Member
Registered: 2009-08-17
Posts: 69

Re: Help creating a Twidge "daemon"..

I surrendered with this one. I have no idea where to go even after being spoonfed. big_smile I might study the basics first and probably bump into this as I move forward. Thanks for the replies anyways! cool

Offline

Board footer

Powered by FluxBB