How to amuse yourself for five minutes

Saturday, 23 Apr 2005

Write this script:

#!/bin/bash
ANSWER=(
  "Signs point to yes."
  "Yes."
  "Reply hazy, try again."
  "Without a doubt."
  "My sources say no."
  "As I see it, yes."
  "You may rely on it."
  "Concentrate and ask again."
  "Outlook not so good."
  "It is decidedly so."
  "Better not tell you now."
  "Very doubtful."
  "Yes -- definitely."
  "It is certain."
  "Cannot predict now."
  "Most likely."
  "Ask again later."
  "My reply is no."
  "Outlook good."
  "Don't count on it."
)
echo "${ANSWER[ $(( $RANDOM % ${#ANSWER[@]} )) ]}"

Call it something like 8ball. Then bind a key in your windowmanager to this command:

8ball | tr -d '\n' | gxmessage -fn 'Georgia 22' -geometry 450 -center \
  -title 'Magic 8ball' -buttons Thanks -default Thanks -file -

Now you have a magic 8-ball to consult.