bug-findutils
[Top][All Lists]
Advanced

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

position dependent bug with -i in xargs


From: Kaleb Pederson
Subject: position dependent bug with -i in xargs
Date: Mon, 02 Aug 2004 08:48:20 -0700
User-agent: KMail/1.6.2

Apparently, I found a bug in the way xargs handles the -i parameter:

// changing only the order of the xargs parameters
$ find . -name "*art*" -print0 | xargs -0 -i -n 25 ./countparams.sh {} | wc -l
14
$ find . -name "*art*" -print0 | xargs -0 -n 25 -i ./countparams.sh {} | wc -l
345

When I place the -i after -n, xargs only places 1 argument on each command 
line.  If I place it before, then it generates the correct number of 
parameters.  So, if I run the above without the line count:

$ find . -name "*art*" -print0 | xargs -0 -n 25 -i ./countparams.sh {}
1
1
... [ 342 more ]
1

$ find . -name "*art*" -print0 | xargs -0 -i -n 25  ./countparams.sh {}
26
26
26
26
26
26
26
26
26
26
26
26
26
21

My countparams.sh script was simply:

#!/bin/bash
echo address@hidden

One other thing, I don't know why, when I had '-n 25' in the xargs line, it 
passed in 26 parameters to my script each time, maybe an off by 1 error?

Anyway, just thought I'd let you know.

--Kaleb

PS: I'll try to keep an eye on the list for the next couple of days, but 
please CC me if possible.  Thanks.




reply via email to

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