繁体   English   中英

如何使用Shell查找某些文件的完整路径?

[英]How to find certain file's full path using shell?

我遇到一个问题,在我的Ubuntu中,我在/local/jenkins/scripts类的目录中工作,这里有许多子目录,我想在目录中获取所有的excute.sh文件,但是您可能知道,如果我使用“ find -name excute.sh ”,它将返回相对路径列表,如下所示。

./TEST933/excute.sh
./TEST923/excute.sh
./TEST323/excute.sh
./TEST920/excute.sh

您能否分享下面的完整路径列表? 谢谢!

/local/jenkins/scripts/TEST933/excute.sh
/local/jenkins/scripts/TEST923/excute.sh
/local/jenkins/scripts/TEST323/excute.sh
/local/jenkins/scripts/TEST920/excute.sh

您可以使用它;

find /local/jenkins/scripts/ -name excute.sh

例如;

$ find -name excute.sh
./TEST920/excute.sh
./TEST933/excute.sh
./TEST923/excute.sh
./TEST323/excute.sh

$ find /tmp/test/ -name excute.sh
/tmp/test/TEST920/excute.sh
/tmp/test/TEST933/excute.sh
/tmp/test/TEST923/excute.sh
/tmp/test/TEST323/excute.sh

与readlink;

find -name excute.sh -exec readlink -f {} \;

暂无
暂无

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

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