Answer the question
In order to leave comments, you need to log in
`
How to escape characters in password in bash script?
I want to write a simple script using bash to recover a password, there is a line
echo `mysql -u$LOGIN_NAME -p$LOGIN_PASSWD $DB_NAME < backup/$DB_NAME.sql`;
The matter is that some bases are not recovered since. the password variable can have characters &, $, etc. That is, I need a similar password [email protected]&@%82 to turn into [email protected]\&@\%82
In my case, the command is sent in the script like this
mysql -uNAME [email protected]&@%82 DB_NAME < backup/
DB_NAME.sql mysql -uNAME
[email protected]\&@\%82 DB_NAME < backup/DB_NAME.sql
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question