I'm a scripting noob and trying to get this find/replace working that injects salt strings in a wp-config.php file, replacing multiple placeholders.
#!/bin/bash -e
function salt() {
uniqSalt=$(cat /dev/urandom | env LC_CTYPE=C tr -dc "a-zA-Z0-9!@#$%^&*()-_ []{}<>~\`+=,.;:/?|" | fold -w 64 | head -n 1)
echo $uniqSalt
}
perl -pi -e "s/put your unique phrase here/$(salt)/g" wp-config.php
This works, but it only generates the salt once so they are all the same - of course it needs to generate it again for every match.
Is it possible to modify this to do what I want? Or is there a better way?
Thanks.