如何组合2个bash命令和print0包括在内

时间:2016-07-05 09:22:34

标签: linux shell unix

Bash版本:3.5

我有两个最喜欢的命令,我使用了很多

这是我的代码

  1. find . -type f -print0 | xargs -0 md5sum -b

  2. find . -type f -print0 | xargs -0 stat -c "%y"

  3. 如何将它们组合起来并得到与我的期望相似的结果。

    结果:

    4d452a2b17f0a6ea9408f959ad7a28a35d67c810 2016-06-28 16:09:34.000000000 211 ./DEW-FILES_COPY_2016-06-28_16092425_.bat

1 个答案:

答案 0 :(得分:5)

这样:

find . -type f -exec bash -c 'file={};m5s=$(md5sum -b  $file|cut -d" " -f1);echo "$m5s "$(stat -c "%y" $file)" $file"' \;