请大家帮忙解释一下find . -print0 | cpio -p0dm ../mnt这句命令

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
smallstar
帖子: 15
注册时间: 2007-06-18 19:23

请大家帮忙解释一下find . -print0 | cpio -p0dm ../mnt这句命令

#1

帖子 smallstar » 2007-06-21 12:23

find . -print0 | cpio -p0dm ../mnt
上次由 smallstar 在 2007-06-21 12:35,总共编辑 1 次。
头像
smallstar
帖子: 15
注册时间: 2007-06-18 19:23

#2

帖子 smallstar » 2007-06-21 12:34

find . 和 find . -print0 的区别
------------------------------------------------------------------
[root@localhost web]# find .
.
./cgi-bin
./cgi-bin/dhcp.cgi
./cgi-bin/dmz.cgi
./cgi-bin/empty.cgi
./cgi-bin/filter.cgi
./cgi-bin/hclone.cgi
./cgi-bin/passwd.cgi
./cgi-bin/pforward.cgi
./cgi-bin/setup.cgi
./cgi-bin/switcha.cgi
./cgi-bin/switch.cgi
./cgi-bin/switchi.cgi
./cgi-bin/upnp.cgi
./cgi-bin/wlan.cgi
./dhcp.html
./dhcp.html~
./dmz.html
./filter.html
./hclone.html
./icons
./icons/ks8695.jpg
./icons/micrel.jpg
./icons/dot.gif
./icons/blank.gif
./icons/booko.gif
./icons/doc2.gif
./icons/fclosed.gif
./icons/fopen.gif
./icons/globe.gif
./icons/home.gif
./icons/lastnode.gif
./icons/mlastnode.gif
./icons/mnode.gif
./icons/node.gif
./icons/plastnode.gif
./icons/pnode.gif
./icons/vertline.gif
./index.html
./layer3f.xml
./Makefile
./mibc.html
./mlBanner.html
./mlfolder.js
./MLiteBanner.html
./mlLogo.html
./mlTree.html
./passwd.html
./pforward.html
./rootDescLan.xml
./rootDescWan.xml
./setup.html
./setup.html.old
./soho.js
./switcha.html
./switch.html
./switchi.html
./upnp.html
./VLANPort.html
./wancic.xml
./wlan.html
[root@localhost web]#

------------------------------------------------------------------------------------
[root@localhost web]# find . -print0
../cgi-bin./cgi-bin/dhcp.cgi./cgi-bin/dmz.cgi./cgi-bin/empty.cgi./cgi-bin/filter.cgi./cgi-bin/hclone.cgi./cgi-bin/passwd.cgi./cgi-bin/pforward.cgi./cgi-bin/setup.cgi./cgi-bin/switcha.cgi./cgi-bin/switch.cgi./cgi-bin/switchi.cgi./cgi-bin/upnp.cgi./cgi-bin/wlan.cgi./dhcp.html./dhcp.html~./dmz.html./filter.html./hclone.html./icons./icons/ks8695.jpg./icons/micrel.jpg./icons/dot.gif./icons/blank.gif./icons/booko.gif./icons/doc2.gif./icons/fclosed.gif./icons/fopen.gif./icons/globe.gif./icons/home.gif./icons/lastnode.gif./icons/mlastnode.gif./icons/mnode.gif./icons/node.gif./icons/plastnode.gif./icons/pnode.gif./icons/vertline.gif./index.html./layer3f.xml./Makefile./mibc.html./mlBanner.html./mlfolder.js./MLiteBanner.html./mlLogo.html./mlTree.html./passwd.html./pforward.html./rootDescLan.xml./rootDescWan.xml./setup.html./setup.html.old./soho.js./switcha.html./switch.html./switchi.html./upnp.html./VLANPort.html./wancic.xml./wlan.html[root@localhost web]#
[root@localhost web]#

有人知道 -print0 参数的解释吗?
头像
smallstar
帖子: 15
注册时间: 2007-06-18 19:23

#3

帖子 smallstar » 2007-06-21 12:42

自己用man find 解决。^_^

-print0
True; print the full file name on the standard output, followed
by a null character. This allows file names that contain new-
lines to be correctly interpreted by programs that process the
find output.


但是cpio -p0dm 的这个参数我还是不知道什么意思。
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

#4

帖子 bones7456 » 2007-06-21 13:04

cpio --help
里面说了:
-p, --pass-through Run in copy-pass mode
-0, --null A list of filenames is terminated by a null character instead of a newline
-d, --make-directories Create leading directories where needed
-m, --preserve-modification-time Retain previous file modification times when creating files
关注我的blog: ε==3
头像
smallstar
帖子: 15
注册时间: 2007-06-18 19:23

#5

帖子 smallstar » 2007-06-21 14:14

谢谢bones7456
回复