I want to produce random string by command
xxd -l 32 -c 32 -p < /dev/random dd1ad9f2deae0af5412e82fbbeb2df6b239e91d49d98638cc5b4bb94aac25463How to set environment variable? Both way below don't wotking
export TMP_RPC_PASS=$(echo xxd -l 32 -c 32 -p < /dev/random)
export TMP_RPC_PASS=$(xxd -l 32 -c 32 -p < /dev/random)bash simple freeze after second variant and waiting something, only ctrl-c allow to return command prompt.
81 Answer
The second version works fine.
The reason it appears to freeze is that /dev/random blocks when the system's entropy pool is exhausted, waiting for new entropy to be collected.
To avoid blocking, use /dev/urandom instead of /dev/random.
For most purposes this is just as good.
export TMP_RPC_PASS=$(xxd -l 32 -c 32 -p /dev/urandom)