bash + mysql语法问题

时间:2016-02-09 11:27:57

标签: mysql bash

我哪里错了?以下是我的代码:

#!/bin/sh
while IFS=" " read LITRAGE FLOW T1 T2 ;

do echo $LITRAGE $FLOW $T1 $T2;

mysql -u admin-um -pdrums um-jekeha << EOF
use um-jekeha;
INSERT INTO main
(date, litrage, flow, t-hot, t-cold)
VALUES
(TIMESTAMP(CURRENT_TIMESTAMP), $LITRAGE, $FLOW, $T1, $T2)
EOF

done < ./log 
exit 0

当我在控制台上运行此脚本时,我收到此消息:

iam@workstation:~/projecto/um/soft$ sh base1.sh 
11.50 0.70 24.33 25.33 
ERROR 1064 (42000) at line 2: 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 '-hot, t-cold)
VALUES
)' at line 2URRENT_TIMESTAMP), 11.50, 0.70, 24.33, 25.33

11.50,0.70,24.33,25.33&lt;&lt;这是“log”中的正确变量。

有什么问题?

1 个答案:

答案 0 :(得分:-1)

使用合理的列名.... - Karoly Horvath

列号没有&#34; - &#34;