これは、端末で問題なく実行されるコマンドです
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."
引用が1つ少なくなります。コマンドで2つのクォートを書き込むと、クォート数の不均衡エラーが発生するためです。