With a "normal" (I mean full) Linux distro, it works just fine:
sleep $(echo "$[ ($RANDOM % 10 ) ]")
OK, it waits for about 0-9 seconds.
but under OpenWRT [not using bash
, but rather ash
]:
$ sleep $(echo "$[ ($RANDOM % 9 ) ]")
sleep: invalid number '$['
$
and why:
$ echo "$[ ($RANDOM % 9 ) ]"
$[ ( % 9 ) ]
$
So does anyone have a way to generate random numbers under OpenWRT, so I can put it into the "sleep"?