3 ms·
should redirect the error/warning output so that it isn't mashed into the command: openssl rand -hex 6 2>/dev/null | sed 's/\(..\)/\1:/g; s/.$//' because
by nikcub 14y ago
should redirect the error/warning output so that it isn't mashed into the command:
openssl rand -hex 6 2>/dev/null | sed 's/\(..\)/\1:/g; s/.$//'
because if you are running this on startup there is a chance HOME or RANDFILE aren't set yet, the .rnd file doesn't exist or the permissions on it are not set properly - resulting in a warning such as "PRNG not seeded" or "unable to write 'random state'" that would be passed into the ifconfig command.
- decklin 14y agoCommand substitution does not capture standard error.
- nikcub 14y agoyou're right, it is from my own script where I do it different with more sanity checks and my own errors, I just applied it to the line above. I'm also in that habit for anything fired at startup or in cron so you don't pollute logs.