Fortune signature

Asked by Ian M. Stewart

How can I insert a "fortune" tag into my signature? You know, that one liner picked at random from a predefined set, to add on after the desired name and reply detail.

Momist

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu evolution Edit question
Assignee:
No assignee Edit question
Solved by:
Stephan Fabel
Solved:
Last query:
Last reply:
Revision history for this message
Best Stephan Fabel (sfabel) said :
#1

Since you haven't specified a mail client, I am going to assume evolution, since that is the default.

Open "Edit - Preferences", choose "Composer Preferences" and the "Signatures" tab. Click on "Add Script", name it "Fortune" and choose "/usr/games/fortune" as the script.

Revision history for this message
Ian M. Stewart (ims) said :
#2

Thanks Stephan, that has solved the problem. Now I need to figure out how to substitute my own file for that in the script.

Momist

Revision history for this message
Ian M. Stewart (ims) said :
#3

Thanks Stephan Fabel, that solved my question.

Revision history for this message
Ian M. Stewart (ims) said :
#4

For anyone else trying to do this, here is the process necessary for utilising your own 'fortune' file.

The fortune files available to the /usr/games/fortune program are stored in /usr/share/games/fortunes. There are several in there, which can remain.

Place your own file in the same directory. The file must be composed of the text sequences you require, separated into blocks with the % symbol, and hard 'carriage returns' from your text editor. Have a quick look at /usr/share/games/fortunes/fortunes for the layout. For some reason, my file imported from a windows machine had some other encoding for the line ends, and had to have all the blocks re-defined.

Then run the strfile command as follows:
user@computer:~$ sudo strfile -r -c% /usr/share/games/fortunes/filename

This will create a filename.dat file in the same place. -r randomises the order. -c% confirms the % sign as the block delimiter (probably not necessary, as it is supposed to be the default).

Now a simple script stored somewhere (home/scripts?) is called from Evolution. Here is the script I'm using:

#!/bin/bash

echo "<div>-- </div>"

echo "<p>Ian</p>"

echo "<pre>"
fortune peakoil
echo "</pre>"

As you can see, peakoil is the name of the file I wish fortune to use.

HTH someone.

Ian