Making New Fortunes (in linux)2 min read

technology.pngAnother week, another bash script!

One of the things I love about scripting things like this is getting to know what’s really going on inside my computer. I’m that way about most things – sure, it’s nice to have things “just do”, but I also want to know why they’re just doing. Maybe I’ll never use that information, maybe I’ll need it tomorrow.

These scripts are usually for things that I needed that other people didn’t provide. For example, the fortune command in *nix.

Fortune’s pretty cool – it randomly pops up a quotation whenever you log in or invoke it. You can pipe the output through cows and get output like this:

/ Have a place for everything and keep  
| the thing somewhere else; this is not |
| advice, it is merely custom.          |
|                                       |
 -- Mark Twain                         /
        ( )
      .( o ).
/ We own our government and are not 
 merely its consumers.             /
          oO)-.                       .-(Oo
         /__  _                     /_  __
           (  |     ()~()         |  )/  /
          __| |    (-___-)        | /|__/
          '  '--'    ==`-'==        '--'  '
/ Writing is easy; all you do is sit  
| staring at the blank sheet of paper |
| until drops of blood form on your   |
| forehead.                           |
|                                     |
 -- Gene Fowler                      /
           (__)    )
              ||--|| *

I see cool-ass quotations everyday; there’s lots of quotation tweeters out there. Many of them I’d like to add to my fortune files. Adding the text isn’t hard – you just put a % between each line in the file and put the file in /usr/share/games/fortunes. Mine are in /usr/share/games/fortunes/bigquotes , for example. But it’s got to run a database command to create this other file and… well, I wanted to automate it. I’m lazy.

The bash script below adds a ONE LINE QUOTATION to the file bigquotes and compiles it for use with the fortune program.

You can download the code to examine or run directly here

blankWas this post helpful or insightful? Buy me a coffee here or here and share this post with others!

Popular posts:

  • The difference between boundaries and rules
  • Review: MAFA - MPD client for Android
  • If there's one Nazi (or a racist) at the table...
  • Weekend Project: Whole House and Streaming Audio for Free with MPD
  • Organizing and Tiling Your Windows on #Openbox Using Only... Openbox
  • Getting the Weather And Forecast with A Bash Script

Recent Posts