#!/bin/bash # The initialization option -I is a capital i, not a small ell. # Initialization of rg nextInit=`rg -S 0 | awk -F' :' '{print $2}'` # Random values in a single variable out=`rg -I $nextInit -N 6 -D Exponential -m 5` randomValues=`echo $out | awk -F' :' '{print $1}'` nextInit=`echo $out | awk -F' :' '{print $2}'` # do something with the random numbers echo Random values in a single variable for value in $randomValues; do echo $value done # Random values in an array - note the () for randomValues out=`rg -I $nextInit -N 5 -D Pareto -k 83456 -b 1.1` randomValues=(`echo $out | awk -F' :' '{print $1}'`) nextInit=`echo $out | awk -F' :' '{print $2}'` # do something with the random numbers numberOfValues=${#randomValues[@]} echo ""; echo Random values in an array for (( i=0; i<$numberOfValues; i++ )); do echo ${randomValues[$i]} done