dmenium

small collection of dmenu scripts
git clone git://edryd.org/dmenium
Log | Files | Refs | LICENSE

m8ball (669B)


      1 #!/usr/bin/env bash
      2 
      3 question="\nAsk the Magic 8 Ball a question"
      4 options=(
      5 "It is certain"
      6 "It is decidedly so"
      7 "Without a doubt"
      8 "Yes, definitely"
      9 "You may rely on it"
     10 "As I see it, yes"
     11 "Most likely"
     12 "Outlook good"
     13 "Yes"
     14 "Signs point to yes"
     15 "Reply hazy try again"
     16 "Ask again later"
     17 "Better not tell you now"
     18 "Cannot predict now"
     19 "Concentrate and ask again"
     20 "Don't count on it"
     21 "My reply is no"
     22 "My sources say no"
     23 "Outlook not so good"
     24 "Very doubtful"
     25 )
     26 
     27 while : ; do
     28     question=$(echo -e "$question" | dmenu "$@" -p "Magic 8 Ball" | xargs echo | bc 2>&1)
     29     [[ $question ]] || break # if no question asked, exit
     30     question="\n${options[$((RANDOM%20))]}"
     31 done