#!/bin/bash set -e # one Card for each of the cardinals Also 4 stages of the day draw_card() { local C=$((RANDOM % 52 + 1)) recsel -e "Order=$C" cards.rec | sed 's/+//g' | fold -w 79 } credits() { echo -e "This is a fortune telling Program based on" echo -e "The CLAMP anime/manga Cardcaptor Sakura" echo -e "And the Fortune Telling Manual released by CLAMP" echo -e "Originally Translated by Vanessah Howard of http://moonlitunderground.org\n and Kokuei (partially)." echo -e "Digital conversion by Pius with Luce" } full_reading() { local N=$((RANDOM % 52 + 1)) local S=$((RANDOM % 52 + 1)) local E=$((RANDOM % 52 + 1)) local W=$((RANDOM % 52 + 1)) echo -e "Your Card from the at the North/Air is" recsel -e "Order=$N" cards.rec | sed 's/+//g' echo "press enter to continue" read clear echo -e "Your Card at East/Water is" recsel -e "Order=$E" cards.rec | sed 's/+//g' read clear echo -e "At the South/Earth" recsel -e "Order=$S" cards.rec | sed 's/+//g' read clear echo -e "Finally at the West/Fire" recsel -e "Order=$W" cards.rec | sed 's/+//g' read clear } cleanup_exit() { echo "have a magical day" echo "Press enter to exit" echo -e "\033[0m" read clear exit } echo -e "\033[37;44m" clear cat kero.txt echo -e "You have opened the book of the Clow" while true; do read -r -p "Menu: Draw/Reading/Credits/Quit " answer case $answer in [Dd]*) clear draw_card continue ;; [Rr]*) clear full_reading continue ;; [Cc]*) clear credits continue ;; [Qq]*) cleanup_exit ;; *) echo "Valid Choices are D/R/Q." ;; esac done