Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-28-2007, 12:47 AM   #1
LQ Newbie
Registered: Nov 2007
Posts: 3

Rep: Reputation: 0
Scripting question concerning random selection of a phrase from a database

I am trying to set up a script that randomly selects from a list of phrases such as "I'm meltiiing..." or "All good things must come to an end" every time I shut down.

So far, I have this, roughly (going from memory):
ECHO All good things must come to an end
shutdown -h
What I want to do is to have it retrieve something from another file to echo before it shuts down.

I appreciate any help,

Old 11-28-2007, 01:19 AM   #2
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Investigate the fortune program, which is designed for this purpose. It also comes with a huge colection of phrases.
Old 11-28-2007, 02:53 AM   #3
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
If you want your own customized quotes and not fortune's bundled ones, you can make your own.
Just create a file (e.g. 'myquotes') in /usr/share/fortune/ with formatting and line-separators similar to the ones in existing fortune files
Create a dat file by running strfile myquotes myquotes.dat
Call it from fortune by running fortune myquotes
See this link for details.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free VMWareServer Network Selection Question Linux31 Linux - Networking 6 06-07-2007 06:24 AM
Shell scripting,;problem reading from database and exporting to html sunksullen Programming 7 05-18-2007 02:16 PM
GTK File Selection Question EnigmaX Programming 3 02-14-2006 12:02 AM
Shell scripting - Random numbers within a range felixc Linux - Newbie 2 10-09-2005 05:41 PM
Question about Distro Selection gpit2286 Linux - Distributions 2 09-30-2004 10:54 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:17 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration