$RANDOM to get random numbers in bash scripts.
yesterday I learned that bash provides
$RANDOM to give you pseudo-random variables on demand.
echo $RANDOM $RANDOM
Though it looks like a variable, apparently it’s a function! From the linked page:
$RANDOMis an internal Bash function (not a constant) that returns a pseudorandom integer in the range 0 – 32767. It should not be used to generate an encryption key.
don’t use it for crypto,
but for quick hacks?
(I used it to generate a series of temporary file names.)
Very nice! 👌
Sure beats the incantations for pulling stuff out of
Questions? Comments? Contact me!