错误:查找匹配时意外的EOF"



我已经创建了一个脚本,用于将CSV数据导出到mysql表。

#!/bin/bash
cd /data/NEW
for f in User*
do
        mysql --user="root" --password="user@123" -e "LOAD DATA LOCAL INFILE  '/data/NEW/"$f"' ignore into table new.table2 fields terminated by ',' enclosed by '"' lines terminated by 'n' (table_date, table_name, table_count);"
done

但我得到以下错误。但是我找不到我把它弄乱的地方。

test.sh: line 6: unexpected EOF while looking for matching `''
test.sh: line 9: syntax error: unexpected end of file
谁能告诉我哪里可以改进?

尝试转义双引号:

#!/bin/bash
cd /data/NEW
for f in User*
do
        mysql --user="root" --password="user@123" -e "LOAD DATA LOCAL INFILE  '/data/NEW/$f' ignore into table new.table2 fields terminated by ',' enclosed by '"' lines terminated by 'n' (table_date, table_name, table_count);"
done

最新更新