意外令牌'('附近的语法错误 [英] syntax error near unexpected token `('
本文介绍了意外令牌'('附近的语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是在ubuntu中写脚本的新手。
I am new to writing scripts, in ubuntu.
FOR /F "tokens=2 skip=4" %%G IN ('svn info --revision HEAD') DO...
我得到以下错误-意外标记'(')附近的语法错误。有人可以告诉我为什么会收到此错误吗?
I get the following error -- "syntax error near unexpected token `('". Can someone tell me why I get this error?
推荐答案
- 迭代命令
svn info --revision HEAD
- 从第5行开始
- 将第二个项目/字段/列分配给变量
% %G
- Iterate through lines output by the command
svn info --revision HEAD
- Starting from line 5
- Assigning the 2nd item/field/column to the variable
%%G
在Bash中执行此操作的众多方法之一是
One of the many ways to do it in Bash is
for variable in $(svn info --revision HEAD | awk 'NR>4 {print $2}'); do
... something fun ...
done
这是什么
- 您通过管道/发送
svn info --revision HEAD
的输出到awk
命令。 - 如果NR(到目前为止已处理的记录/行数)大于4(即跳过前4行),
awk
打印出第二列/字段/项目。 -
整个<$ c $然后,将c> $(..)替换为
awk
的结果,类似于
- You pipe/"send" the output of
svn info --revision HEAD
toawk
command. - If the NR (number of records/lines processed so far) is greater than 4 (i.e. skips first 4 lines),
awk
prints out the 2nd column/field/item. The whole
$(..)
is then replaced by the result ofawk
which is something like
item2_line5
item3_line6
item2_line7
....
由于Bash的分词,每一行都被视为列表中的一个项目,并且 for
会遍历每个项目在列表中。
Due to Bash's word splitting, each line is treated as an item in a list, and for
iterates through each item in the list.
这篇关于意外令牌'('附近的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文