标签:linux
#cat 111.sh
#!/bin/bash
function rand(){
min=$1
max=$(($2-$min+1))
num=$(cat /dev/urandom | head -n 10 | cksum | awk -F ‘ ‘ ‘{print $1}‘)
echo $(($num%$max+$min))
}
rnd=$(rand 1 33)
echo $rnd
exit 0
#cat 222.sh
#!/bin/bash
function rand(){
min=$1
max=$(($2-$min+1))
num=$(cat /dev/urandom | head -n 10 | cksum | awk -F ‘ ‘ ‘{print $1}‘)
echo $(($num%$max+$min))
}
rnd=$(rand 1 16)
echo $rnd
exit 0
111.sh执行6次,222.sh 执行1次,你懂的... ...
标签:linux
原文地址:http://dodowolf.blog.51cto.com/793581/1603613