简体   繁体   English

将jar文件复制到多个目录

[英]copying jar files into multiple directories

I have written a bash script to copy the files into multiple directories but its not working. 我已经写了一个bash脚本,将文件复制到多个目录中,但是它不起作用。

find /usr/local/tomcat/ -not -path /usr/local/tomcat/webapps/test/WEB-INF  -type d  -name WEB-INF | xargs -n 1 echo cp /tmp/myjar.jar

The output of the find command is correct but the file is not getting copied. find命令的输出正确,但是文件没有被复制。 Where am I going wrong? 我要去哪里错了?

您正在xargs命令中调用echo ,只需将其删除即可,它应该可以工作

You have a mistake in your script. 您的脚本有误。 The echo command is not needed. 不需要echo命令。 Replace it with this instead, just removing the command. 取而代之的是,只需删除命令即可。

find /usr/local/tomcat/ -not -path /usr/local/tomcat/webapps/test/WEB-INF  -type d  -name WEB-INF | xargs -n 1 cp /tmp/myjar.jar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM