我在一个例子中遇到了如下使用find命令(它将目录结构复制到哪里)
find olddir -name script.sh -printf "%p\0" -printf "newdir/%P\0" | xargs -0L2 cp -n
Run Code Online (Sandbox Code Playgroud)
我不清楚%p和%PI之间的差异读取了找不到多少的查找的手册页
%p File's name.
%P File's name with the name of the command line argument under which it was found removed.
Run Code Online (Sandbox Code Playgroud)
%p和%P之间有什么区别
我对它的含义感到困惑
%P File's name with the name of the command line argument under which it was found removed.
Run Code Online (Sandbox Code Playgroud)
你有没试过吗?的%p,在你的榜样,包括打印的文件olddir的一部分,并%P打印它没有.几乎就是文档所说的内容.简单的例子:
$ ls -R
.:
dir/
./dir:
file
$ find dir -name file -printf '%p\n'
dir/file
$ find dir -name file -printf '%P\n'
file
Run Code Online (Sandbox Code Playgroud)