Web Hosting Talk







View Full Version : random numbers - bash script


BMurtagh
05-04-2003, 10:05 PM
hello. i'm working on an update script that needs to generate a number between 1 and 4. i was looking at the $RANDOM value in bash, but i'm having a hard time understanding how to use it to do a range. any help would be appreciated. thank you

cperciva
05-05-2003, 01:03 AM
Use jot.

sholden
05-05-2003, 02:57 AM
$(($RANDOM%4+1))

BMurtagh
05-05-2003, 11:35 AM
thank you sholden