0

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
1
  • Have you tried twidge setup and entered the authorisation key?
    – qbi
    Dec 18, 2012 at 11:03

1 Answer 1

0

You should write a short script which performs the operation, eg /var/www/post.sh

#!/bin/bash
shuf -n 1 /var/www/tweets.txt | twidge update

Make it executable with chmod +x post.sh, and add it to crontab.

1
  • Why a script?. It's only a one line command, looks like an extra complication to me. Why not adding the command directly to crontab?. Dec 18, 2012 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.