delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
Date: | Mon, 19 Feb 2007 11:46:37 -0500 |
From: | Jean-Rene David <jrdavid AT magma DOT ca> |
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 |
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 |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |