I have this bash script name test.sh and located in /tmp:
source $HOME/.backmeuprc databases=`mysql -h$DBHOST -u$DBUSER -p$DBPASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
the .backmeuprc file is located in
/home/user and has the following:
DBHOST="localhost" DBUSER="mysqluser" #MySQL user that can dump all databases DBPASSWORD="somepasswordwith!and$and+andotherspecialcaracters'" DBPORT="3306"
and the issue is when the password has all the characters possible. How can I escape the
$DBPASSWORD in this case? The issue is that the command is inside backticks. I have no experience in bash scripts but I've tried with
"$DBPASSWORD" and with
'$DBPASSWORD' and it doesn't work.
LATER EDIT: see the link of the script here, line 170 https://github.com/Ardakilic/backmeup/blob/master/backmeup.sh