On 06/02/2015 04:02 PM, Peng Yu wrote: > The following command will call ls. But since there is no input, > shouldn't xargs quit without doing anything? Thanks. > > xargs -0 ls </dev/null
Try: xargs -r -0 ls </dev/null Per POSIX, the behavior of one-or-more (without -r) is required, to match historical practice, and existing scripts rely on that behavior. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html We have the -r extension precisely because sometimes the zero-or-more behavior makes more sense. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature