sed is not new for me. But it’s such a versatile tool. And I always have trouble finding the precice syntax I need. So here is a collection of examples. It probably will grow in the years.
Replace the home dir with ~.
COMPACT=$(echo ${HOME} | sed "s#${HOME}#~#g")Replace %SALT% with the variable $SALT in the file wp-config.php
sed -i -E "s/%SALT%/${SALT}/g" "wp-config.php"