I want to print out a random number and encrypt it, like so: echo $RANDOM | sha256sum.
I would expect this to take the standard output of echo $RANDOM and pipe it into the encryption function. However doing this twice in a row (or however many times) , gives me the same output.
Here's what I know:
echo $RANDOMworks. I do in fact get a new number at every print.Calling
exec zshto reset my shell, and then running the code generates a new random output (that keeps repeating).
This is obviously not a huge problem for, but I am really curious to find out why this is happening.
I am using Zsh. Switching to Bash also gives me different results. This seems to be Zsh-related then. I'd still like to know why. Can someone explain why I am not getting a random output?