#!/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' } 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 echo -e "You have opened the book of the Clow" while true; do read -r -p "Menu: Draw/Reading/Quit " answer case $answer in [Dd]*) draw_card continue ;; [Rr]*) full_reading continue ;; [Qq]*) cleanup_exit ;; *) echo "Valid Choices are D/R/Q." ;; esac done