[Top][All Lists]

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

[bug #51220] [wishlist] Using -I with -n

From: Adam Danischewski
Subject: [bug #51220] [wishlist] Using -I with -n
Date: Sat, 10 Jun 2017 22:14:26 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0


                 Summary: [wishlist] Using -I with -n 
                 Project: findutils
            Submitted by: adanisch
            Submitted on: Sun 11 Jun 2017 02:14:25 AM UTC
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: None
           Fixed Release: None



It would be nice if you could use -I substitution option with -n count option
together in the same command. 

$> var=/tmp && echo "one two three four" | xargs -n1 touch "${var}/{}"

$> var=/tmp/test && mkdir -p "${var}" && echo "one two three four" | xargs -n1
| xargs -I{} cp -v "/tmp/{}" "${var}"
‘/tmp/one’ -> ‘/tmp/test/one’
‘/tmp/two’ -> ‘/tmp/test/two’
‘/tmp/three’ -> ‘/tmp/test/three’
‘/tmp/four’ -> ‘/tmp/test/four’

Yet it would be nice if instead, we could: 
$> var=/tmp/test && mkdir -p "${var}" && echo "one two three four" |xargs -n1
-I{} cp -v "/tmp/{}" "${var}"
cp: cannot stat ‘/tmp/one two three four’: No such file or directory

Unfortunately we can't combine -n and -I substitution at the moment and I'm
not sure why not. It could be useful. 


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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