That's why I chose to make it explicit, and thus more likely to be caught in review if done.
export SYSTEM_SECRET=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
echo "SYSTEM_SECRET is $SYSTEM_SECRET" @(48..57 + 65..90 + 97..122) | Get-Random -Count 32 | ForEach-Object -Begin {$secret = ''} -Process {$secret += [char] $PSItem} -End {$env:SYSTEM_SECRET = $secret; Write-Host "SYSTEM_SECRET is $secret"}tr -dc A-Za-z0-9_ < /dev/urandom | head -c 32
?
And yes the "cat" is not necessary.
Of course, this runs the risk that a user will simply "salt" the sample you provide up to the necessary length, which makes the length of their secret effectively the difference between the minimum length and the sample length.
1) admin accounts are generated on startup with random passwords. These are printed on the console on the first startup only.
2) in a configuration format I use, there is a special keyword for using a random string as a value which is different each time the config is parsed.
I think any secure value should be either generated for you or random on each startup unless specified otherwise. It would greatly improve the security of some projects out there.
That's not going to stop people from using those exact values. How many breaches have we seen due to the lack of sane defaults? Tutorial code (especially when written by the people putting out the software) is a default, and it's likely to result in plenty of people running this exact code in production.