Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

daviesgeek

macrumors newbie
Original poster
Jul 10, 2011
8
0
USA!
How do you write a shell script with multiple choice answers and fill-in-the-blank answers? I have tried Googling this, but I didn't come up with anything. Thanks in advance for your help.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,754
8,443
A sea of green
quest.sh
Code:
#!/bin/bash

echo "What is the capital of Assyria?"
echo 1. Rome
echo 2. Boston
echo 3. Assur
echo 4. Coconuts
read answer
if [ "$answer" -ne 3 ] ;
then
 echo "Into the gorge you go!"
else
 echo "You may pass."
fi
For fun, replace echo with say.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.