I guess I would do it a little differently (with backticks):

for x in `ls ./samples/*.bla | head -10`;
do
   cp $x (to wherever)
done

or as a one liner:

for x in `ls ./samples/*.bla | head -10`; don cp $x ; done

Cheers,
Vern

On Thu, Jan 27, 2011 at 10:45 AM, Christer Watson
<[email protected]> wrote:
> a couple questions. don't you need to increment the $counter variable?
> Don't you need to use the $counter variable to choose just one item
> from a list of files in the /samples directory?
>
> Cheers,
>
> --Christer
>
>
> On Thu, Jan 27, 2011 at 10:39 AM, Travis Paul <[email protected]> wrote:
>> ye olden bash loops...
>>
>>          #!/bin/bash
>>          counter=0
>>          while [  $counter -lt 10 ]; do
>>              cp ./samples/*.bla
>>          done
>>
>> On Thu, Jan 27, 2011 at 10:34 AM, Jonathan Bartels
>> <[email protected]> wrote:
>>>
>>> I have a large batch of sample data files that are run through an
>>> application by copying them to an 'inbox' directory. I would like to
>>> do something like this:
>>>
>>> cp ./samples/*.bla --limit 10
>>>
>>> So that only 10 of the sample files are copied instead of the whole
>>> mess of 10000. It can be any files. I checked the manpage and didn't
>>> see anything.
>>>
>>> Any ideas?
>>>
>>> --
>>> -----
>>> Jonathan Bartels
>>>
>>> _______________________________________________
>>> Fwlug mailing list
>>> [email protected]
>>> http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org
>>>
>>> This is a public list and all posts are archived publicly. Please keep
>>> this in mind before posting.
>>
>>
>
> _______________________________________________
> Fwlug mailing list
> [email protected]
> http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org
>
> This is a public list and all posts are archived publicly. Please keep this 
> in mind before posting.
>



-- 
Vern Ceder
[email protected], [email protected]
The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW

_______________________________________________
Fwlug mailing list
[email protected]
http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org

This is a public list and all posts are archived publicly. Please keep this in 
mind before posting.

Reply via email to