Change "seq 4" to whatever amount of numbers you need: ran="";for i in $(seq 4); do n=$(($RANDOM%10)); ran=$ran$n; done;echo $ran