这是在终端上运行得很好的命令
egrep Version ./path/fileName.java | cut -d"\"" -f4
我在我的代码中使用了以下内容
<exec command="egrep Version ./path/fileName.java | cut -d"\" -f4)" outputproperty="VER"/>
但是出现错误
the command attribute is deprecated.
[exec] Please use the executable attribute and nested arg elements.
[exec] Result: 1
[echo] "Version: egrep: invalid argument `\\' for `--directories'
[echo] Valid arguments are:
[echo] - `read'
[echo] - `recurse'
[echo] - `skip'
[echo] Usage: egrep [OPTION]... PATTERN [FILE]...
[echo] Try `egrep --help' for more information."
少了一个quot; 在命令中,因为如果我写 2 个引号,它会给我的引号数不平衡错误。