I'm not sure what you mean by "preselected within a script".
But the example I gave could be applied to variables or arrays in a script.
The basic rundown on my example is this:
shuf will take a random line from the file tmp1 (you would most likely rename this to say "posts"), which contains the main body's of the twitter posts, with the word you want to replace, marked with xxx. The "|" will take the output from the command to the left, and send it to the input of the command to the right.
Code:
sed "s/xxx/$(shuf -n 1 tmp2)/"
- sed will replace "xxx" within the output of the first shuf command, with a random line from the file tmp2 (lets say greetings, good, great, fantastic, etc).
I apologise if this appears insulting.
You could easily replace the files tmp1 and tmp2 as they occur in that command, with variables, such as
Code:
shuf -n 1 $message | sed "s/xxx/$(shuf -n 1 $greeting)/"
which could be passed as commandline arguments, or edited in the script itself.
I had a quick look at the man page online for twidge, and from what i can work out, once the config file is set up with your username/password etc, it would be a matter of
Code:
#!/bin/bash
message="~/message_body" # or whichever file you choose
greeting="~/greetings" # or whichever file you choose
tweet=$(shuf -n 1 $message | sed "s/xxx/$(shuf -n 1 $greeting)
twidge update $tweet
You could elaborate on that, by finding the day of the week, and reading from a particular file of greetings on a certain day, etc.
I get the feeling this hasn't helped much though...