• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 699
  • Last Modified:

Bash script. Random number between 10 and 60

i need a bash script .. when executed i want him to pick a number between 10 and 60 and write it in another file
0
keepwalking
Asked:
keepwalking
1 Solution
 
sunnycoderCommented:
Hi keepwalking,

RANGE=60
FLOOR=10
number=0
while [ "$number" -le $FLOOR ]
do
  number=$RANDOM
  let "number %= $RANGE"  # Scales $number down within $RANGE.
done
echo "Random number between $FLOOR and $RANGE ---  $number"

http://www.tldp.org/LDP/abs/html/randomvar.html#EX21

Cheers!
Sunnycoder
0
 
keepwalkingAuthor Commented:
thanx Sunnycoder
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now