开发者

Using find to pass files to a jar

Using 'find' I'm pla开发者_如何学Cnning to pass all files with a specific ending as an argument to a jar-file.

find $directory -type f -name "*.in"

Somehow this is supposed to happen:

java -jar MyJar-jar input.in

How can this be performed?

Thanks in Advance


find "$directory" -type f -name '*.in' -exec java -jar MyJar.jar {} \;

Replace \; with + if the application can take more than one file at a time as arguments.


xargs -0 -a<(find $directory -type f -name '*.in' -print0) java -jar MyJar.jar


java -jar MyJar.jar `find $directory -type f -name "*.in"`

should do the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜