简体   繁体   English

bash变量-转义点

[英]bash variable - escaping point

Im trying to save text in variable. 我试图将文本保存在变量中。 But the point will translated as dir. 但是要点将转换为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"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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