view 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
line wrap: on
line source

#!/bin/bash
rolls="$*"
if [ "$rolls" = "" ] ; then rolls="1d6" ; fi

for i in $rolls
do
    if expr "$i" : ".*[dD].*" >& /dev/null
    then
        rollc=`echo "$i" | sed 's/[dD].*//'`
        diesz=`echo "$i" | sed 's/.*[dD]//'`
    else
        rollc=1
        diesz="$i"
    fi

    roll=0
    for (( j = 0; $j < $rollc; j++ ))
    do
        roll=$(( roll + (RANDOM % diesz) + 1 ))
    done

    echo -n $roll' '
done
echo