我正在尝试将参数从 bash 脚本传递给 mysql 脚本。bash脚本是
#!/bin/bash
for file in `ls *.symbol`
do
path=/home/qz/$file
script='/home/qz/sqls/load_eval.sql'
mysql -u qz -h compute-0-10 -pabc -e "set @pred = '$path'; source $script;"
done
load_eval.sql 是
use biogrid;
load data local infile @pred into table lasp
fields terminated by ','
lines terminated by '\n'
(score, symbols);
运行 bash 脚本时,我收到错误消息:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@pred into table lasp ..
似乎参数@pred 的值没有传递到mysql 脚本中。