我目前有一个看起来像这样的脚本:
sql="SELECT id FROM user
WHERE (email LIKE '%a@b.com'
OR email LIKE '%c@d.com'
OR email LIKE '%f@g.com' );"
read -a ids < <(ssh localhost "mysql test -e \"$sql\"")
但它没有正确执行。使用set -x
时,输出如下所示:
+ read -a usu_ids
++ ssh localhost 'mysql test -e " SELECT' id FROM user WHERE '(usu_email' LIKE ''\''%a@b.com'\''' OR email LIKE ''\''%c@d.com'\''' OR email LIKE ''\''%f@g.com'\''' '); "'
它给出了一个虚假的价值。有什么建议么?
谢谢