-
Notifications
You must be signed in to change notification settings - Fork 0
/
kopmunt.sh
executable file
·46 lines (34 loc) · 888 Bytes
/
kopmunt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
while true; do
# echo "---heads or tails---- (lowercase)"
# echo "put in q to quit"
# read input
# if [ "$input" == q ]; then
# break
# fi
while true; do
echo "heads or tails (lowercase)"
echo -e "put in q to quit\n"
read input
if [ "$input" == q ]; then
exit
elif [[ "$input" != "heads" && "$input" != "tails" ]]; then
echo -e "\nwrong input give heads or tails as input"
else
break
fi
done
randm=$(($RANDOM % 2 + 1))
if [ $randm = 1 ]; then
anwser="heads"
else
anwser="tails"
fi
echo -e "\nyour anwser is $input"
echo -e "\nthe coin shows $anwser"
if [ "$input" = "$anwser" ]; then
echo -e "you won\n"
else
echo -e "you lost\n"
fi
done