# Generate a random integer between 0 and 100, inclusive echo $[ ( $RANDOM % 101 ) ] # Generate either a 0 or 1 echo $[ ( $RANDOM % 2 ) ] # Generate an integer from 1 to 10 echo $[ ( $RANDOM % 10 ) + 1 ] # Generate a random integer from 1 to 10 without $RANDOM if it is not available grep -m1 -ao '[0-9]' /dev/urandom | sed s/0/10/ | head -n1