annotate bin/roll @ 11918:a51467a3be09
draft
<wob_jonas> learn can\'t is the most frequent word whose pronunciation varies between /\xc9\x91\xcb\x90/ and /\xc3\xa6/ depending on dialect. A list is: advance, advantage, after, answer, ask, aunt, branch, can\'t, cast, chance, class, craft, command, contrast, dance, demand, disaster, draft, enhance, example, fast, glass, glance, grant, graph, grass, half, last, laugh, mask, maste
author |
HackEso <hackeso@esolangs.org> |
date |
Thu, 29 Aug 2019 10:06:05 +0000 |
parents |
e037173e0012 |
children |
|
rev |
line source |
0
|
1 #!/bin/bash
|
|
2 rolls="$*"
|
|
3 if [ "$rolls" = "" ] ; then rolls="1d6" ; fi
|
|
4
|
|
5 for i in $rolls
|
|
6 do
|
|
7 if expr "$i" : ".*[dD].*" >& /dev/null
|
|
8 then
|
|
9 rollc=`echo "$i" | sed 's/[dD].*//'`
|
|
10 diesz=`echo "$i" | sed 's/.*[dD]//'`
|
|
11 else
|
|
12 rollc=1
|
|
13 diesz="$i"
|
|
14 fi
|
|
15
|
|
16 roll=0
|
|
17 for (( j = 0; $j < $rollc; j++ ))
|
|
18 do
|
|
19 roll=$(( roll + (RANDOM % diesz) + 1 ))
|
|
20 done
|
|
21
|
|
22 echo -n $roll' '
|
|
23 done
|
|
24 echo
|