bash – find命令中%p和%P之间的区别是什么
发布时间:2020-12-15 21:32:51 所属栏目:安全 来源:网络整理
导读:我在一个例子中遇到了如下使用find命令(它将目录结构复制到哪里) find olddir -name script.sh -printf "%p " -printf "newdir/%P " | xargs -0L2 cp -n 我不清楚%p和%P之间的差异 我阅读了发现的手册,其中没有多说 %p File's name. %P File's name with
我在一个例子中遇到了如下使用find命令(它将目录结构复制到哪里)
find olddir -name script.sh -printf "%p " -printf "newdir/%P " | xargs -0L2 cp -n 我不清楚%p和%P之间的差异 %p File's name. %P File's name with the name of the command line argument under which it was found removed. %p和%P之间有什么区别 我对它的含义感到困惑 %P File's name with the name of the command line argument under which it was found removed. 解决方法
你有没试过吗?在您的示例中,%p打印包含olddir部分的文件,%P不打印它.几乎就是文档所说的内容.简单的例子:
$ls -R .: dir/ ./dir: file $find dir -name file -printf '%pn' dir/file $find dir -name file -printf '%Pn' file (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |