Mark M. Hoffman on 10 May 2005 03:08:42 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Tutorials


Hi Jon:

* Jon Nelson <quincy@linuxnotes.net> [2005-05-06 15:14:57 -0400]:
> Sure it can and so can any other command with 'xargs':
> 
>     $ find ../dir1/ | cpio -o --format=tar > test.tar
> 
> would be:
> 
>     $ find ../dir1/ | xargs tar cvf test.tar

Ugh, no.  The xargs man page says:

	xargs reads arguments from the standard input, delimited
	by  blanks  (which can  be protected with double or single
	quotes or a backslash) or newlines, and executes the command
	(default is /bin/echo) one or more times with any initial-
	                       ^^^^^^^^^^^^^^^^^
	arguments followed by arguments read from standard input.

If you use xargs with tar that way (on a big enough directory tree)
you will end up missing files.

OTOH, if you pass '-x' to xargs, it will at least quit with an error
message instead of failing silently.

Regards,

-- 
Mark M. Hoffman
mhoffman@lightlink.com

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug