X-Spam-Check-By: sourceware.org Date: Mon, 19 Feb 2007 11:46:37 -0500 From: Jean-Rene David To: cygwin AT cygwin DOT com Subject: Re: xargs problem Message-ID: <20070219164637.GB8804@princo> Mail-Followup-To: cygwin AT cygwin DOT com References: <1171899485 DOT 45d9c45d44ef0 AT www DOT domainfactory-webmail DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1171899485.45d9c45d44ef0@www.domainfactory-webmail.de> User-Agent: Mutt/1.5.13 (2006-08-11) X-magma-MailScanner-Information: Magma Mailscanner Service X-magma-MailScanner: Clean X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com * Markus Hoenicka [2007.02.19 10:45]: > $ 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 Your assumption about what xargs does is incorrect. It does not call the command once for each argument on its standard input. Instead, it constructs a command-line, the length of which is system-dependent. The number of arguments it will take for each call to the command isn't clear at all and even depends on the length of the command itself. You need to tell xargs explicitly that you want to take the arguments one by one: $ echo foo bar | xargs -t -n1 /bin/echo foo foo /bin/echo bar bar -- JR -- 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/