-bash: 意外标记附近的语法错误`('
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23172970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
-bash: syntax error near unexpected token `('
提问by Adam_G
I'm trying to run the query below in Terminal on OSX. It keeps returning:
我正在尝试在 OSX 上的终端中运行以下查询。它不断返回:
-bash: syntax error near unexpected token `('
I'm sure I'm overlooking something very dumb. If someone could point me in the right direction, I'd appreciate it. The command includes the SQL query for the program to execute:
我确定我忽略了一些非常愚蠢的东西。如果有人能指出我正确的方向,我将不胜感激。该命令包括要执行的程序的 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
回答by Ashish Gaur
The problem is when you use "
bash tries to evaluate anything within it instead you should use '
, try this:
问题是当您使用"
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
or as @bhesh has specified you can delimit the characters which bash will try to evaluate :
或者正如@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