How to get a random number in bash
Posted: | Categories: tech
Use the $RANDOM. $RANDOM returns a number between 0 and 32767. To get a random number between 0 and 50 you can use $ echo $[RANDOM%50] $ # or $ echo $((RANDOM%50)) To get a random number between 1 and 50 you can use $ echo $[RANDOM%50+1] $ # or $ echo $((RANDOM%50+1)) Read more...