Try this for a 2-byte random number (line may wrap):

echo "ibase=16;" `cat /dev/urandom | head -2c | od -x | fgrep 0000000 | cut -d ' ' -f2 
| tr '[a-f]' '[A-F]'` | bc

YAISOLFYOM (roughly expands to Yet Another Incredible Shell One-Liner
>From Ye Olde Monke :)

Regards,

-- Raju aka OldMonk

>>>>> "Chris" == Christopher Vasanth <[EMAIL PROTECTED]> writes:

    Chris> Hi there:

    Chris> Can anyone show me how to generate a random number in a
    Chris> shell script?

    Chris> Thanks

    Chris> Vasanth

----------------------------------------------
The mailing list archives are available at
http://lists.linux-india.org/cgi-bin/wilma/LIH

Reply via email to