#!/bin/sh
# quotesh by Heiji Horde (horde@reed.edu)
# Please send additions, deletions, corrections, and suggestions to me.
#
# This program is intended to be distributed free to any and all Babylon 5
# fans for their *personal use* only.
#
# If you like this program all I ask is that you send a letter to your local
# station stating your support for Babylon 5.
#
# =====
#
# To get this to run, just edit the QUOTELIST variable to point to where the
# configuration file is.

QUOTELIST=/u/a/horde/prj/quote/list.cnf

# Get quote file to use
list=`head -1 $QUOTELIST`
ranfile=`expr $$ % $list`
ranfile=`expr $ranfile + 1`
ranfile=`expr $ranfile + 1`
quotefile=`head -$ranfile $QUOTELIST|tail -1`

# Get the quote
awk 'BEGIN {
  numquote='`head -1 $quotefile`'
  ranquote=('$$' % numquote)+1
  }
  {
  if ($1=="%%")
    loop=loop+1
  if (loop==ranquote)
    if ($1!="%%")
      print $0
  }' $quotefile
