Hack 85. How to generate random number in bash shell

by Ramesh

Use the $RANDOM bash built-in function to generate random number between 0 – 32767 as shown below.

  1. $ echo $RANDOM
  2. 22543
  3.  
  4. $ echo $RANDOM
  5. 25387
  6.  
  7. $ echo $RANDOM
  8. 647