Hi Peng,

if you read the man page the behaviour is defined (note the "one or more 
times"):

---------------------
xargs reads items
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 items read from standard input
---------------------

So basically your command below will call 'ls' once with no arguments and 
display the contents of the current directory

thanks


----- Original Message -----
> From: "Peng Yu" <pengyu...@gmail.com>
> To: bug-findutils@gnu.org
> Sent: Wednesday, 3 June, 2015 8:02:19 AM
> Subject: Why xargs still call the command when there is no input?
> 
> 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
> 
> --
> Regards,
> Peng
> 
> 

Reply via email to