Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Magic eight ball bash script. Put this in your $PATH and never make a decision without it.
#! /bin/bash
number=$(echo $((1 + RANDOM % 20)))
case $number in
1) msg="It is certain.";;
2) msg="It is decidedly so.";;
3) msg="Without a doubt.";;
4) msg="Yes - definitely.";;
5) msg="You may rely on it.";;
6) msg="As I see it, yes.";;
7) msg="Most likely.";;
8) msg="Outlook good.";;
9) msg="Yes.";;
10) msg="Signs point to yes.";;
11) msg="Reply hazy, try again.";;
12) msg="Ask again later.";;
13) msg="Better not tell you now.";;
14) msg="Cannot predict now.";;
15) msg="Concentrate and ask again.";;
16) msg="Don't count on it.";;
17) msg="My reply is no.";;
18) msg="My sources say no.";;
19) msg="Outlook not so good.";;
20) msg="Very doubtful.";;
echo "$msg"
say "$msg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.