Pretty self-explanatory, but the $RANDOM variable only changes when the output is not piped. Is this a bug in zsh or the result of my lack of understanding somewhere? Here is the result of my commands:
┌──(root㉿linux)-[~/scripts]
└─# echo $RANDOM
14103
┌──(root㉿linux)-[~/scripts]
└─# echo $RANDOM
30417
┌──(root㉿linux)-[~/scripts]
└─# echo $RANDOM
3090
┌──(root㉿linux)-[~/scripts]
└─# echo $RANDOM | md5sum | head -c 20
af5655b26ab87e81ef4f
┌──(root㉿linux)-[~/scripts]
└─# echo $RANDOM | md5sum | head -c 20
af5655b26ab87e81ef4f
┌──(root㉿linux)-[~/scripts]
└─# echo $RANDOM | md5sum | head -c 20
af5655b26ab87e81ef4f
Why is this happening? The same script in bash seems to work.