X-Spam-Check-By: sourceware.org
From: Markus =?iso-8859-1?q?Sch=F6nhaber?= <mailing-cygwin@schoenhaber.de>
Reply-To: cygwin@cygwin.com
To: cygwin@cygwin.com
Subject: Re: xargs problem
Date: Mon, 19 Feb 2007 17:34:16 +0100
User-Agent: KMail/1.9.6
References: <1171899485.45d9c45d44ef0@www.domainfactory-webmail.de>
In-Reply-To: <1171899485.45d9c45d44ef0@www.domainfactory-webmail.de>
MIME-Version: 1.0
Content-Type: text/plain;   charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200702191734.17079.mailing-cygwin@schoenhaber.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Markus Hoenicka wrote:

> maybe I'm being dense, but xargs does not seem to do what it should:
>
> $ echo test1 test2|xargs -t
> /bin/echo test1 test2
> test1 test2
>
> I'd expect the output to read:
>
> /bin/echo test1
> test1
> /bin/echo test2
> test2
>
> What am I doing wrong?

Your expectation is wrong. xargs will - by default - not start a seperate 
instance of the to-be-executed process for each of the arguments it reads 
from stdin, but instead it gathers some and feeds them to the process at 
once.
You can limit the number or args each sub-process will be fed with -n 
or --max-args. I. e.
echo test1 test2|xargs -t -n 1
should do what you expect.

BTW: this is not Cygwin-specific.

Regards
  mks

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

