简体   繁体   中英

bash variable - escaping point

Im trying to save text in variable. But the point will translated as dir.

M2_1="GRANT USAGE ON *.* TO '$USER'@'%' IDENTIFIED BY PASSWORD '$MYSQL_PASSWORD';"

How can i escape *.* ?

example output should be:

GRANT USAGE ON *.* TO 'web88'@'%' IDENTIFIED BY PASSWORD '123456789';"

It works for me. You are probably not quoting the variable when using it later:

M2_1="GRANT USAGE ON *.* TO '$USER'@'%' IDENTIFIED BY PASSWORD '$MYSQL_PASSWORD';"
echo "$M2_1"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM