Q:

Random number between range in shell

How I can generate random number between 0-60 in sh (/bin/sh, not bash)? This is a satellite box, there is no $RANDOM variable, and other goods [cksum, od (od -vAn -N4 -tu4 < /dev/urandom)].
I want to randomize a crontab job's time.

A:

How about using the nanoseconds of system time?
date +%N

It isn't like you need cryptographically useful numbers here.
Depending on which version of /bin/sh it is, you may be able to do:
$(( date +%N % 60 ))
If it doesn't support the $(()) syntax, but you have dc, you could try:
dc -e `date +%N`' 60 % p'

Without knowing which operating system, version of /bin/sh or what
tools are available it is hard to come up with a solution guaranteed to work.

A:

If you have tr, head and /dev/urandom, you can write this:
tr -cd 0-9 </dev/urandom | head -c 3

Then you have to use the remainder operator to put in 0-60 range.

