Execure a random command from .txt file?

Posted by Alberto Burgos on Ask Ubuntu See other posts from Ask Ubuntu or by Alberto Burgos
Published on 2012-12-18T10:22:18Z Indexed on 2012/12/18 11:13 UTC
Read the original article Hit count: 293

Filed under:
|
|

I have a Ubuntu server, and I'm trying to print a Twitter quote using the app "twidge". So I made a list of tweets on a .txt file. I want to print one tweet (per line) from that file and send it to Twitter via twidge (or what ever other method was possible).

I can print a random phrase with shuf:

shuf -n 1 /var/www/tweets.txt

and it works. It sends me back one of the tweets, but, it does not send it to Twitter, even if the "in line" phrase is a command. i.e:

twidge update "bla bla bla"

It just prints on the screen, but don't send it to Twitter. I tried turning the .txt to .sh, but don't work... any idea?

by the way, i want to use it with crontab, something like this:

15 * * * * shuf -n 1 /var/www/tweets.txt

© Ask Ubuntu or respective owner

Related posts about server

Related posts about cron