bug-findutils
[Top][All Lists]
Advanced

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

Re: Why xargs still call the command when there is no input?


From: Morgan Weetman
Subject: Re: Why xargs still call the command when there is no input?
Date: Tue, 2 Jun 2015 18:50:59 -0400 (EDT)

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" <address@hidden>
> To: address@hidden
> 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

[Prev in Thread] Current Thread [Next in Thread]