- 论坛徽章:
- 0
|
# [root@ad11 /]# tar -zcvPf /export/home/2008-03-28-18-tar/all-new.tar.gz 2> /dev/null $(ls / | grep -v -e proc -e mnt -e export) | sed 's/\([ ]\{1,\}\)/\1\//g;s/^./\/&/g'
/INFORMIXTMP/
/INFORMIXTMP/.infxdirs
/bin/
/bin/mailx
/bin/kbd_mode
/bin/date
/bin/tar
/bin/mt
/bin/red
/bin/ln
/bin/nice
/bin/ash.static
打包,压缩除/proc, /mnt, /export目录外的所有目录。
从上面看出,根路径是被打包进去了,也是符合要求的绝对路径(带了/符号的)。
tar tzvf /export/home/2008-03-28-18-tar/all-new.tar.gz
drwxrwxr-t informix/informix 0 2008-03-28 17:10:08 INFORMIXTMP/
-rw-rw-r-- root/informix 57 2008-03-27 14:54:56 INFORMIXTMP/.infxdirs
drwxr-xr-x root/root 0 2008-03-28 13:36:10 bin/
lrwxrwxrwx root/root 0 2008-03-29 00:16:35 bin/mailx -> mail
-rwxr-xr-x root/root 10096 2004-06-16 08:30:41 bin/kbd_mode
-rwxr-xr-x root/root 47776 2006-04-11 01:21:52 bin/date
-rwsr-xr-x root/root 15488 2006-04-14 21:16:25 bin/traceroute6
-rwxr-xr-x root/root 179432 2006-04-13 21:35:50 bin/tar
-rwxr-xr-x root/root 20752 2004-08-09 21:15:21 bin/mt
lrwxrwxrwx root/root 0 2008-03-29 00:16:35 bin/red -> ed
-rwxr-xr-x root/root 31880 2006-04-11 01:21:52 bin/ln
-rwxr-xr-x root/root 23272 2006-04-11 01:21:52 bin/nice
-rwxr-xr-x root/root 627232 2004-06-16 04:31:32 bin/ash.static
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
[root@ad11 /]#
最后检查包,却没有发现根路径,没有/ 符号,还是相对路径。
请问为什么绝对路径无法打入包?只能实现相对路径打包?
但是如果是逐个目录打包是能够将/符号打入包的,可以是绝对路径。
|
|