Yet another randomizer.






Many months ago I introduced a batch file called Oracle. The one incentive I had was to separate the data from the code and make the code was flexible and reusable. In this case the author keeps the code and the data in the same file. of course that makes it seemingly more portable.Coding is both a science and an art. How you do it is up to you.


$ ./8ball.sh
Outlook good



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

Comments

Popular posts from this blog

Guiless?

Web.com and Network Solutions, the Walmart of the internet.

MSOffice vs Libreoffice