Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
作为提交后挂钩的一部分,我尝试将所有更改为本地文件夹的文件复制到本地文件夹中 - 使用此脚本(仅附加脚本的相关部分):
svnlook changed ${REPOS} -r ${REV} | sed "s/^....//" | xargs -I {} svnlook cat ${REPOS} {} -r ${REV} > /tmp/commit2/{}
它不会用 xargs 参数替换第二个 {},而是按原样使用它(创建文件名“{}”)。
输出重定向后是否可以替换参数?
谢谢,罗伊
不是那样的,不。shell 进行重定向,而不是xargs. xargs甚至没有“意识到”正在发生重定向。
xargs
您可以使用以下内容:
svnlook changed ${REPOS} -r ${REV} | sed "s/^....//" | while read -r line ; do svnlook cat ${REPOS} "$line" -r ${REV} > /tmp/commit2/"$line" done