xargs 用法

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
tosail2010
帖子: 83
注册时间: 2011-03-27 19:01
联系:

xargs 用法

#1

帖子 tosail2010 » 2011-11-03 16:31

find $(KERNEL_DIR)/linux-2.6.35 | xargs touch
xargs touch这里的用法怎么使用?
A year's plan starts with spring.
rodent
帖子: 4
注册时间: 2011-11-07 10:55

Re: xargs 用法

#2

帖子 rodent » 2011-11-07 11:01

find ./ -type f | xargs touch
头像
tosail2010
帖子: 83
注册时间: 2011-03-27 19:01
联系:

Re: xargs 用法

#3

帖子 tosail2010 » 2011-11-07 11:12

rodent 写了:find ./ -type f | xargs touch
xargs touch这么用是什么目的呢?
A year's plan starts with spring.
rodent
帖子: 4
注册时间: 2011-11-07 10:55

Re: xargs 用法

#4

帖子 rodent » 2011-11-07 11:42

xargs会把输入作为touch的参数而不是touch的标准输入
没人疼
帖子: 13
注册时间: 2010-01-11 13:13

Re: xargs 用法

#5

帖子 没人疼 » 2011-11-08 11:30

touch 一个存在的文件的话,功能就是更新文件的访问或者修改时间。应用场景,比如你用 sersync2 进行文件的实时分发同步,sersync只同步最新修改的文件。所以,他进行实时更新之前要做一次整体同步,如果你没有做整体同步,可以用find ./ -type f | xargs touch 更新所有文件的修改时间,就等于做了一次完整同步了。
回复