-
Notifications
You must be signed in to change notification settings - Fork 0
/
DictionaryQue1.sh
45 lines (41 loc) · 1.44 KB
/
DictionaryQue1.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
#!/bin/bash -x
read -p "Random number =" $((RANDOM%6+1))
declare -A dectionary
num1=0
num2=0
num3=0
num4=0
num5=0
num6=0
i=1
j=10
while ((num1<$j && num2<$j && num3<$j && num4<$j && num5<$j && num6<$j))
do
randomCheck=$((RANDOM%6+1))
dictionary[$i]=$randomCheck
((i++))
case $randomCheck in 1)
((num1++))
;;
2)
((num2++))
;;
3)
((num3++))
;;
4)
((num4++))
;;
5)
((num5++))
;;
6)
((num6++))
;;
*)
echo "repeat again"
;;
esac
done
echo "all random number =" ${dictionary[@]}
echo "all total number of dice=${dictionary[@]} times"