-bash:意外令牌附近的语法错误`('

时间:2014-04-19 17:07:32

标签: java sql macos bash terminal

我正在尝试在OSX上的Terminal中运行下面的查询。它一直在回归:

-bash: syntax error near unexpected token `('

我确定我忽视了一些非常愚蠢的事情。如果有人能指出我正确的方向,我会很感激。该命令包括要执行的程序的SQL查询:

java -Xmx16g -cp .:lib/* edu.cuny.util.VectorToInstancesConverter train HandednessJ48 “SELECT * FROM collection1.Session1 WHERE Subj_Id!=402 and Subj_Id not in ( select Subj_id from collection1.Session2) AND Subj_Id IN ( SELECT Subj_Id FROM collection1.userdata WHERE 'DominantHand' = 'l' OR 'DominantHand' = 'r')” 12 J48

1 个答案:

答案 0 :(得分:3)

问题是,当您使用" bash尝试评估其中的任何内容时,您应该使用',请尝试以下操作:

java -Xmx16g -cp .:lib/* edu.cuny.util.VectorToInstancesConverter train 
HandednessJ48 'SELECT * FROM collection1.Session1 WHERE Subj_Id!=402 
and Subj_Id not in ( select Subj_id from collection1.Session2) AND 
Subj_Id IN ( SELECT Subj_Id FROM collection1.userdata WHERE 
'DominantHand' = 'l' OR 'DominantHand' = 'r')' 12 J48

或@bhesh已指定您可以分隔bash将尝试评估的字符:

java -Xmx16g -cp .:lib/* edu.cuny.util.VectorToInstancesConverter train 
HandednessJ48 "SELECT * FROM collection1.Session1 WHERE Subj_Id!=402 
and Subj_Id not in \( select Subj_id from collection1.Session2\) AND 
Subj_Id IN \( SELECT Subj_Id FROM collection1.userdata WHERE 
'DominantHand' = 'l' OR 'DominantHand' = 'r'\)" 12 J48