So I've recently been experimenting with the case command. I know how to use it, but I'd like some help figuring out something. I wrote this script shown below
Code: Select all
#!/bin/bash
echo "What is your name?"
read myname
echo "Hi $myname"
echo "Would you like to continue running this script? Yes or no?"
read answer
case $answer in
yes) echo "Okay, let's continue.";;
no) echo "Okay, terminating script now."
exit 0;;
*) echo "The answer you typed is not valid, please type yes or no.";;
esac
~Cmiller21