dice
#!/bin/bashcount=$(echo $1 | sed -e 's/\([0-9]\)d\([0-9]\)/\1/g')if [[ $count = "" ]]; thencount=1fihigh=$(echo $1 | sed -e 's/\([0-9]\)d\([0-9]\)/\2/g')if [[ $high = "" ]]; thenecho "Syntax: roll [dice_count]d[die_sides]"echo "ie: to roll two 6-sided dice: roll 2d6"exitfirolls=()while [[ $count > 0 ]]; dorolls+=" $((1 + $RANDOM % $high))"let count=$count-1 donetotal=0for i in ${rolls[@]}; dolet total+=$idoneecho $(tput bold)$total$(tput sgr0) "("$(echo $rolls | sed -e 's/ /+/g')")"