Bug 493

Summary: xargs does not support -I
Product: Busybox Reporter: frater <fraterbugzilla>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED FIXED    
Severity: enhancement CC: busybox-cvs
Priority: P5    
Version: 1.19.x   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: Target:
Build:

Description frater 2009-07-29 11:20:47 UTC
xargs (or find -exec) does not support the {} or the -I option.
It is therefore not possible to use it when the command you need to execute takes options that come behind the arguments.

The find command becomes much less powerfull for this reason.
Comment 1 Denys Vlasenko 2009-07-30 05:56:42 UTC
Each bug report should be about one bug, not three.
You report that:
1. find does not support {}
2. xargs does not support {}
3. xargs does not support -I

#1 is not true:

# ./busybox find README -exec echo ">{}<" ";"
>README<

#2 is not true per se - xargs should not handle {} specially, I think.

#3 is true also for GNU xargs 4.1.20. Hmm. GNU xargs 4.4.0 has it working:

# /usr/bin/xargs --version
xargs (GNU findutils) 4.4.0
# echo qwe | /usr/bin/xargs -I _ echo mv 1/_ 2/_
mv 1/qwe 2/qwe
Comment 2 Denys Vlasenko 2009-07-30 10:27:51 UTC
changed summary to read "xargs does not support -I"
Comment 3 frater 2010-05-30 12:22:11 UTC
I filed this bug a long time ago, but never saw anything happen with it. It's not that I'm impatient, but maybe I'm not being clear enough.

You gave an example which I had to change a bit because I don't have that file README and it should really have '-name' as well

This is what I get:

# /bin/busybox find /bin -name busybox
/bin/busybox
# /bin/busybox find /bin -name busybox -exec echo ">{}<" ";"
#

No output there....
It does work on my Ubuntu:

root@ubuntuLTS:/opt/ASSP/logs# find /usr/bin -name find
/usr/bin/find
root@ubuntuLTS:/opt/ASSP/logs# find /usr/bin -name find  -exec echo ">{}<" ";"
>/usr/bin/find<
Comment 4 Denys Vlasenko 2010-05-31 00:43:12 UTC
(In reply to comment #3)
> # /bin/busybox find /bin -name busybox
> /bin/busybox
> # /bin/busybox find /bin -name busybox -exec echo ">{}<" ";"
> #
> 
> No output there....

This definitely works for me (and for a lot of other people).
Please specify exact busybox version and attach your .config - I will try to reproduce.
Comment 5 rweb 2013-06-21 01:58:33 UTC
Still true for 1.19.
Comment 6 rweb 2013-06-21 02:01:55 UTC
Per descriptiong of the problem... This is what I am receiving.
/usr/bin/xargs: invalid option -- I
BusyBox v1.19.0 (2012-02-29 14:20:08 PST) multi-call binary.

Usage: xargs [OPTIONS] [PROG ARGS]

Run PROG on every item given by stdin

        -p      Ask user whether to run each command
        -r      Don't run command if input is empty
        -0      Input is separated by NUL characters
        -t      Print the command on stderr before execution
        -e[STR] STR stops input processing
        -n N    Pass no more than N args to PROG
        -s N    Pass command line of no more than N bytes
        -x      Exit if size is exceeded
Comment 7 Denys Vlasenko 2014-02-27 10:19:12 UTC
Fixed in git:

commit 6f068904dc142657bb596f91196f9113f1838cbe
Author: Denys Vlasenko <vda.linux@googlemail.com>
Date:   Thu Feb 27 11:17:06 2014 +0100

    xargs: add support for -I and -i